public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->outData(array(), 0); exit; } $this->apf = APF::get_instance(); $this->request = $this->apf->get_request(); $this->response = $this->apf->get_response(); $params = $this->request->get_parameters(); //经纪人ID $this->brokerId = self::$BrokerInfo['BaseInfo']['BROKERID']; // TODO 替换为其他的方式 //经纪人城市ID $this->cityId = self::$BrokerInfo['BaseInfo']['CITYID']; $type = $params['type']; switch ($type) { case 'esf': //二手房房源数据获取 $this->getBrokerEsfPro(); break; case 'zf': //租房房源数据获取 $this->getBrokerZfPro(); break; default: $this->outData(array(), 0); break; } }
/** * init env * @param $request * @param $out * @throws Exception */ private static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); // 获取好租brokerId $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']); // 获取账户余额 $balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance'); if (!$balance['status']) { throw new Exception_BllErrorException($balance['msg']); } $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0; // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU); $out['isBidCity'] = false; $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU); // 获取经纪人信息 if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) { throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']'); } // 身份是否通过 $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']); // 获取套餐相关 $out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE); // 获取经纪人主推房源 $out['mainSpreadProIds'] = array(); $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']); if ($mainSpreads) { foreach ($mainSpreads as $v) { $out['mainSpreadProIds'][$v->propId] = $v->propId; } } }
/** * @param AJKRequest $request * @param array $out * @throws Exception */ public static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); $brokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerIdEx($out['ajkBrokerId']); if (empty($brokerInfo)) { throw new Exception('获取金铺经纪人信息失败:ajkBrokerId [' . $out['ajkBrokerId'] . ']'); } $out['brokerInfo'] = $brokerInfo; // 获取金铺brokerId $out['jpBrokerId'] = $brokerInfo['id']; // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU); $out['isBidCity'] = false; $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::JINPU); $out['bidTip'] = '精选'; //经纪人全部有效房源 $out['houses'] = Bll_House_JpHouseInfo::getAllHouseInfoEx($out['ajkBrokerId']); $out['houseIds'] = array(); foreach ($out['houses'] as $infoP) { $base = $infoP['base']; $info = $infoP['info']; $type = $infoP['houseType']; $propertyId = in_array($type, array(1, 2)) ? $info['buildingId'] : $info['propertyId']; $out['houseIds'][$type][$base['id']] = array('houseId' => $base['id'], 'propertyId' => $propertyId); } $out['publishUrl'] = Bll_Broker_Combo_ManageJp::buildHousePublishUrl(); }
public function handle_request_internal() { APF::get_instance()->get_response()->set_content_type('text/html', 'utf-8'); $this->ctx = APF::get_instance()->get_request()->get_parameters(); $this->ctx['ajkBrokerId'] = APF::get_instance()->get_request()->getBrokerId(); $this->ctx['cityId'] = APF::get_instance()->get_request()->getBrokerCityId(); // 入参校验 if (!$this->ctx['code'] || !$this->ctx['site'] || !$this->ctx['act']) { $this->ctx['code'] = Const_PublishCode::HOUSE_PARAM_COMPLETE; } $msgs = APF::get_instance()->get_config('message', 'publishmessage'); if (!$this->ctx['message']) { $this->ctx['message'] = $msgs[$this->ctx['code']]; } // 头标题 $this->ctx['titleMsg'] = in_array($this->ctx['code'], array(Const_PublishCode::HOUSE_SPREAD_SUCCESS, Const_PublishCode::SPREAD_PROP_HANDLE_STOP, Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, Const_PublishCode::SPREAD_PROP_OUT_LIMIT, Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, Const_PublishCode::SPREAD_PROP_PLAN_IN, Const_PublishCode::SPREAD_PROP_BUDGET_OVER, Const_PublishCode::SPREAD_PROP_NO_COMBO, Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, Const_PublishCode::SPREAD_PROP_COMBO_FAIL, Const_PublishCode::PSEUDO_ERROR)) ? '推广' : '保存'; $this->ctx['isSuccess'] = $this->ctx['code'] < 200; $this->ctx['titleMsg'] .= $this->ctx['isSuccess'] ? '成功' : '失败'; $this->prepareMessage(); $this->ctx['isChoiceCity'] = Bll_City::isChoiceCity(static::$intBrokerCityID); $this->ctx['isShowCaseCity'] = Bll_City::isShowCaseCity(static::$intBrokerCityID); if ($this->ctx['site'] == 'jp') { $this->ctx['isShowCaseCity'] = false; } $this->prepareOthers(); //$this->ctx['debug'] && (print_r($this->ctx) && die); $this->setAttributes($this->ctx); return 'House_Result'; }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->redirect('/user/combo/brokerhome'); exit; } $this->apf = APF::get_instance(); $this->request = $this->apf->get_request(); $this->response = $this->apf->get_response(); $this->params = $this->request->get_parameters(); //回调地址 $r_url = base64_decode($this->params['r_url']); if (empty($r_url)) { $r_url = $_SERVER['HTTP_REFERER']; if (empty($r_url)) { $r_url = '/ajkbroker/showcase/zf'; } } $msg = $this->params['msg']; if (!$msg) { //没有报错信息,就是提示成功 $type = $this->params['type'] ? $this->params['type'] : Const_ShowcaseOrders::SALE_DB; //二手房经纪人ID $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID']; if ($type == Const_ShowcaseOrders::SALE_DB) { //二手房 $proCountMax = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT; $brokerAdProInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdSalePropInfo($brokerId, true); $brokerAdInfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders(array('brokerId' => $brokerId), Const_ShowcaseOrders::SALE_DB); } else { //租房 $proCountMax = Const_ShowcaseOrders::RENT_PRO_MAX_COUNT; $brokerAdProInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($brokerId, true); $brokerAdInfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders(array('brokerId' => $brokerId), Const_ShowcaseOrders::RENT_DB); } //订单信息不存在 if (empty($brokerAdInfo)) { APF::get_instance()->get_response()->redirect($r_url); } $dayCount = ceil((strtotime($brokerAdInfo->endDate) - strtotime($brokerAdInfo->startDate)) / 86400) + 1; $this->request->set_attribute('dayCount', $dayCount); $this->request->set_attribute('proCount', count($brokerAdProInfos)); $this->request->set_attribute('proCount', count($brokerAdProInfos)); $this->request->set_attribute('leftProCount', $proCountMax - count($brokerAdProInfos)); //橱窗价格 $tmp = array('cityId' => self::$BrokerInfo['BaseInfo']['CITYID'], 'status' => 1, 'startDate' => date('Ymd')); $cityPrice = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, $type); $this->request->set_attribute('price', !empty($cityPrice->discountPrice) ? round($cityPrice->discountPrice / 100, 2) : 8); } //报错信息 $this->request->set_attribute('msg', $msg); $this->request->set_attribute('r_url', $r_url); return 'Showcase_Error'; }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->outData(array(), 0); exit; } $this->apf = APF::get_instance(); $this->request = $this->apf->get_request(); $this->response = $this->apf->get_response(); $this->params = $this->request->get_parameters(); $this->brokerId = self::$BrokerInfo['BaseInfo']['BROKERID']; $this->userId = self::$BrokerInfo['BaseInfo']['USERID']; $this->getBrokerMoney(); }
/** * @param AJKRequest $request * @param array $out * @throws Exception */ public static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); // 获取好租brokerId $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']); // 获取账户余额 /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance'); if (!$balance['status']) throw new Exception_BllErrorException($balance['msg']); $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0; */ // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU); $out['isBidCity'] = false; $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU); $out['bidTip'] = '精选'; // 获取经纪人信息 if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) { throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']'); } // 身份是否通过 $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']); // 获取该经纪人房源 $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']); // 获取改经纪人所有房源质量 //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props'])); $out['propsQuality'] = static::getHzPropsQuality($out['props']); if (count($out['props']) > 0) { foreach ($out['props'] as $proId => $prop) { $out['props'][$proId]['proId'] = $proId; // 获取剩余时间 $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']); // 是否手机房源 $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : ''); } } // 获取经纪人主推房源 $out['mainSpreadProIds'] = array(); $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']); if ($mainSpreads) { foreach ($mainSpreads as $v) { $out['mainSpreadProIds'][$v->propId] = $v->propId; } } }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->redirect('/user/combo/brokerhome'); exit; } $this->apf = APF::get_instance(); $this->request = $this->apf->get_request(); $this->response = $this->apf->get_response(); $this->type = $this->getType(); $this->brokerId = $this->getBrokerId(); $this->userId = self::$BrokerInfo['BaseInfo']['USERID']; $this->cityId = self::$BrokerInfo['BaseInfo']['CITYID']; //存在橱窗订单信息,直接跳转至管理页面 $brokerAdInfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders(array('brokerId' => $this->brokerId), $this->type); if (!empty($brokerAdInfo)) { $this->toManage(); } //橱窗价格 $tmp = array('cityId' => $this->cityId, 'status' => 1, 'startDate' => date('Ymd')); $cityPriceInfo = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, $this->type); $cityPrice = empty($cityPriceInfo->discountPrice) ? 8 : round($cityPriceInfo->discountPrice / 100, 2); $this->request->set_attribute('cityPrice', $cityPrice); $this->params = $this->request->get_parameters(); //表单提交 if ($this->request->is_post_method() && intval($this->params['days'])) { $this->formAction($cityPrice); } if ($this->type == Const_ShowcaseOrders::SALE_DB) { $type = 'ajk'; } else { $type = 'hz'; } $this->request->set_attribute('type', $type); $this->request->set_attribute('index', 2); //精选推广开关 $isChoice = !Bll_City::isChoiceCity($this->cityId) ? 0 : 1; $this->request->set_attribute('isChoice', $isChoice); $this->request->set_attribute('broker', self::$BrokerInfo); return $this->handle_request_index(); }
/** * @param Manage_ProplistController $controller * @param AJKRequest $request * @param AJKResponse $response * * @return array */ public static function getBrokerSpreadInfo($controller, $request, $response) { $cityId = $request->getBrokerCityId(); $brokerId = $request->getBrokerId(); $query = trim($request->get_parameter('q')); $pageParams = array('query' => $query); if (!empty($query)) { $pageParams['searchByCommunity'] = !is_numeric($query); } $bidPropIds = array(); $fixPropIds = array(); /** * 速度优化阶段一 * $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId); */ $brokerCheckState = $controller->getBrokerCheckState(); $isChoiceCity = Bll_City::isChoiceCity($cityId); /** 精选城市 */ if ($isChoiceCity) { $pageParams['bidTip'] = '精选'; } $pageParams['isChoiceCity'] = $isChoiceCity; $pageParams['isBidCity'] = false; $pageParams['isShowCaseCity'] = Bll_City::isShowCaseCity($cityId, Const_Site::ANJUKE); if ($isChoiceCity) { /** 获取竞价计划信息 */ $pageParams['bidPlanList'] = static::getBrokerBidPlanList($brokerId, $cityId, $bidPropIds, $isChoiceCity); $pageParams['bidPropIds'] = $bidPropIds; $pageParams['bidClickCount'] = Bll_Plan_Bid_AjkPlan::getBrokerBidClick($brokerId, date('Ymd'), $cityId); $pageParams['bidCost'] = Bll_Plan_Bid_AjkPlan::getBrokerBidCost($brokerId, date('Ymd'), $cityId); } /** 获取定价计划信息 */ $pageParams['fixPlanPropList'] = static::getBrokerFixPlanList($brokerId, $cityId, $fixPropIds, $brokerCheckState); $pageParams['fixPropIds'] = $fixPropIds; if (!empty($pageParams['fixPlanPropList'])) { $pageParams['effectURL'] = Bll_Plan_Fix_AjkPlan::GetPlanFixedPriceDetailUri($pageParams['fixPlanPropList'][0]['planInfo']['id'], 0, 1); } $houseInfoList = static::getBrokerAllPropInfoList($brokerId, $cityId, $fixPropIds, $bidPropIds, $pageParams['isChoiceCity'], $query); /** 房源数量 > 0 没有计划就创建计划 创建失败的话应该是API 错误 */ if (!empty($houseInfoList) && empty($pageParams['fixPlanPropList'])) { Bll_Ppc_ServiceAPI::createFixPlan($brokerId, '定价', 100000, 1, 21181); } $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId); if (empty($ppcLimitInfo)) { echo '<script type="text/javascript"> alert("服务器繁忙,请重试!"); </script>'; exit; } $pageParams['ppcLimitInfo'] = $ppcLimitInfo; /** 房源质量信息 */ $pageParams['houseSolly'] = static::getHouseSollyResult($houseInfoList['houseIdList']); $pageParams['selectLimitTempAvailable'] = static::checkSelectLimitTempAvailable($cityId); $pageParams['fixPropIds'] = array_values(array_intersect($fixPropIds, array_keys($houseInfoList['fixSpreadHouseList']))); //$pageParams['bidPropIds'] = array_values(array_intersect($bidPropIds, $pageParams['fixPropIds'])); if ($isChoiceCity) { $houseBidInfoList = array(); $houseBidStatus = array(); foreach ($pageParams['bidPlanList'] as $bidInfo) { $houseBidInfoList[$bidInfo['propId']] = $bidInfo; $houseBidStatus[$bidInfo['propId']] = $bidInfo['status']; } $pageParams['houseBidStatus'] = $houseBidStatus; $houseInfoList['fixSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['fixSpreadHouseList'], $houseBidInfoList, $cityId); } /** 精选引导优化 */ $choiceFunctionOptimizationGuide = false; /* if ($isChoiceCity && count($houseInfoList['fixSpreadHouseList']) > 0) { if (Bll_Broker_AjkBrokerGuideNew::getGuideStatus($brokerId, 'Choice_Function_Optimization') == 0) { $choiceFunctionOptimizationGuide = true; } } */ $pageParams['choiceFunctionOptimizationGuide'] = $choiceFunctionOptimizationGuide; return array_merge($pageParams, $houseInfoList); }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->redirect('/user/combo/brokerhome'); exit; } //获取经纪人id $objRequest = APF::get_instance()->get_request(); $cityid = self::$BrokerInfo['BaseInfo']['CITYID']; $objRequest->set_attribute('PayType', self::$BrokerInfo['BaseInfo']['PAYTYPE']); $isCombo = Bll_Combo_HouseRelation::isComboCity($cityid); $tmp = array('cityId' => $cityid, 'status' => 1, 'startDate' => date('Ymd')); $cityPrice = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, Const_ShowcaseOrders::RENT_DB); $todayPrice = round($cityPrice->discountPrice / 100, 2); $intBrokerID = $objRequest->getBrokerId(); //好租经纪人ID $hzBrokerId = Bll_Broker_BrokerCheckInfo::getHzBrokerIdByAjkBrokerId($intBrokerID); $userId = $objRequest->getUserId(); $data = array('brokerId' => $intBrokerID); $orderinfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders($data, $this->db); //判断经纪人是否有订单 if (!$orderinfo) { $this->toManage('/ajkbroker/showcase/zf/'); } $lavedays = ceil((strtotime($orderinfo->endDate) - strtotime(date('Ymd'))) / 3600 / 24); if ($orderinfo->isStop == 1 || $lavedays < 0) { $order_status = 'stop'; } else { $objRequest->set_attribute('lavedays', $lavedays); $objRequest->set_attribute('lastday', date('Y-m-d', strtotime($orderinfo->endDate))); $order_status = 'open'; } //获取参数值 $params = APF::get_instance()->get_request()->get_parameters(); $days = intval($params['days']); //status=2是停止,status=1是续费 if ($params['status'] == 2) { if ($orderinfo->isStop == 0) { $stopstatus = Bll_Broker_ShowcaseOrders::getInstance()->stopBrokerOthers($orderinfo, $cityPrice->discountPrice, $this->db); if ($stopstatus['status']) { $this->toManage(); } else { $this->toError($stopstatus['msg']); } } else { $msg = '订单类型不能操作'; $this->toError($msg); } } elseif ($params['status'] == 1 && $days >= 1) { $BrokerMoney = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId); if ($BrokerMoney < $todayPrice) { $this->toError(Const_ShowcaseOrders::MONEY_NOT_ENOUGH); } $Continueorder = Bll_Broker_ShowcaseOrders::getInstance()->continueBrokerOthers($orderinfo, $days, $cityPrice->discountPrice, $this->db); if ($Continueorder['status']) { $this->toManage(); } else { $this->toError($Continueorder['msg']); } } elseif ($params['status'] == 3) { if (!empty($params['rooms'])) { $proIds = explode(';', $params['rooms']); $filterProIds = Bll_Broker_ShowcaseAdSetPro::getInstance()->filterProIds($intBrokerID, $cityid, $this->db, $proIds); //有些房源不在线上展示 if (count($filterProIds) != count($proIds)) { $this->toError('有些房源没在线上推广,操作失败!'); } $res = Bll_Broker_ShowcaseAdSetPro::getInstance()->insertAdProsInfo($intBrokerID, $cityid, $proIds, $this->db); if (!$res['status']) { $this->toError($res['msg']); } else { //插入成功,跳转至管理页面 if ($orderinfo->isStop == 0) { $log = array(); $log['brokerId'] = $orderinfo->brokerId; $log['cityId'] = $orderinfo->cityId; $log['endDate'] = $orderinfo->endDate; $log['startDate'] = $orderinfo->startDate; $log['opType'] = Const_ShowcaseOrders::OPTYPE_6; $log['totalDays'] = ceil((strtotime($orderinfo->endDate) - strtotime($orderinfo->startDate)) / 3600 / 24) + 1; $log['createTime'] = time(); Bll_Broker_ShowcaseOrders::getInstance()->insertSetLog($log, $this->db); } $this->toManage(); } } } $orderCreated = date('Ymd', $orderinfo->createTime); if ($orderCreated < date('Ymd')) { $click = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerClick($intBrokerID, date('Ymd', strtotime('-1 days')), $this->db); if (!$click->quantityCount) { $objRequest->set_attribute('YClick', 0); } else { $objRequest->set_attribute('YClick', $click->quantityCount); } $objRequest->set_attribute('IS_YClick', true); } if ($isCombo['data']) { $comboList = Bll_Combo_HouseRelation::getHouseRelations($intBrokerID, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); if (!empty($comboList)) { if (count($comboList) >= Const_ShowcaseOrders::SALE_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($comboList); } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMianNew = array(); foreach ($propMianInfo as $propMianVal) { $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true); $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true); } $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initComboZfProData($proInfos, $propMianNew, $comboList); } else { $fixedProInfos = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProInfo($hzBrokerId); if (!empty($fixedProInfos)) { $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($fixedProInfos, 'proid'); $proInfos_tmp = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $proIdsc = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfos_tmp, 'proid'); $proInfosc = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIdsc, $cityid); if (!empty($proInfosc)) { if (count($proInfosc) >= Const_ShowcaseOrders::RENT_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::RENT_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($proInfosc); } } else { $fixedProInfosCnt = 0; } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proStatus = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProStatus($proIds); $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMianNew = array(); foreach ($propMianInfo as $propMianVal) { $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true); $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true); } $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initZfProData($proInfos, $propMianNew, $proStatus); } if (count($proList) > $fixedProInfosCnt) { $fixedProInfosCnt = count($proList); } $objRequest->set_attribute('type', 'hz'); $objRequest->set_attribute('index', 2); //精选推广开关 $isChoice = Bll_City::isChoiceCity($cityid, Const_Site::HAOZU); $objRequest->set_attribute('isChoice', $isChoice); $objRequest->set_attribute('proList', $proList); $objRequest->set_attribute('fixedProInfosCnt', $fixedProInfosCnt); $objRequest->set_attribute('order_status', $order_status); $objRequest->set_attribute('todayPrice', $todayPrice); return 'Showcase_ZfManage'; }
/** * @param User_Statistics_BrokerStatisticsController $controller * @param AJKRequest $request * @param AJKResponse $response * * @return array */ public static function getBrokerStatistics($controller, $request, $response) { $brokerId = $request->getBrokerId(); $cityId = $request->getBrokerCityId(); $params = $request->get_parameters(); $pageParams = static::setSearchDay($params); $isChoiceCity = Bll_City::isChoiceCity($cityId); $isBidCity = Bll_City::isChoiceCity($cityId); $isShowCaseCity = Bll_City::isShowCaseCity($cityId); $pageParams['isChoiceCity'] = $isChoiceCity; $pageParams['isBidCity'] = $isBidCity; $pageParams['isShowCaseCity'] = $isShowCaseCity; $startDate = date('Ymd', $pageParams['beginDateUnix']); $endDate = date('Ymd', $pageParams['endDateUnix']); if ($startDate > $endDate) { return $pageParams; } /** 非精选城市 */ if ($isBidCity) { $pageParams['bidMessage'] = '竞价'; } if ($isChoiceCity) { $pageParams['bidMessage'] = '精选'; } $tempBrokerStatisticsInfoList = Model_Broker_AjkComboBrokerDay::getBrokerStatistics($brokerId, $startDate, $endDate); if (empty($tempBrokerStatisticsInfoList)) { return $pageParams; } $total = array('TotalPropNum' => 0, 'TotalClickNum' => 0, 'TotalAmount' => 0, 'saleProp' => 0, 'saleGoodProp' => 0, 'saleNewProp' => 0, 'saleNewGoodProp' => 0, 'saleVppv' => 0, 'saleBidProp' => 0, 'saleBidGoodProp' => 0, 'saleBidNewProp' => 0, 'saleBidNewGoodProp' => 0, 'saleBidCost' => 0, 'saleBidVppv' => 0); $dateList = static::getDateList($pageParams['beginDateUnix'], $pageParams['endDateUnix']); if ($isShowCaseCity) { $adPriceInfo = static::getBrokerPriceInfo($brokerId, $startDate, $endDate); $adClickInfo = static::getBrokerAdClickInfo($brokerId, $startDate, $endDate); } $brokerStatisticsInfoList = array(); foreach ($dateList as $key => $date) { $brokerStatisticsInfoList[$key] = array('_DayDate' => $date); } foreach ($tempBrokerStatisticsInfoList as $brokerStatisticsInfo) { $date = $brokerStatisticsInfo['dayDate']; $brokerStatisticsInfo['_DayDate'] = $dateList[$date]; $brokerStatisticsInfo['TotalPropNum'] = $brokerStatisticsInfo['saleProp']; $brokerStatisticsInfo['TotalClickNum'] = $brokerStatisticsInfo['saleVppv']; $brokerStatisticsInfo['TotalAmount'] = $brokerStatisticsInfo['saleBidCost']; if ($isBidCity || $isChoiceCity) { $brokerStatisticsInfo['TotalPropNum'] += $brokerStatisticsInfo['saleBidProp']; $brokerStatisticsInfo['TotalClickNum'] += $brokerStatisticsInfo['saleBidVppv']; } /** * 总计 */ $total['TotalPropNum'] += $brokerStatisticsInfo['TotalPropNum']; $total['TotalClickNum'] += $brokerStatisticsInfo['TotalClickNum']; $total['TotalAmount'] += $brokerStatisticsInfo['TotalAmount']; $total['saleProp'] += $brokerStatisticsInfo['saleProp']; $total['saleGoodProp'] += $brokerStatisticsInfo['saleGoodProp']; $total['saleNewProp'] += $brokerStatisticsInfo['saleNewProp']; $total['saleNewGoodProp'] += $brokerStatisticsInfo['saleNewGoodProp']; $total['saleVppv'] += $brokerStatisticsInfo['saleVppv']; if ($isBidCity || $isChoiceCity) { $total['saleBidProp'] += $brokerStatisticsInfo['saleBidProp']; $total['saleBidVppv'] += $brokerStatisticsInfo['saleBidVppv']; $total['saleBidCost'] += $brokerStatisticsInfo['saleBidCost']; $total['saleBidNewProp'] += $brokerStatisticsInfo['saleBidNewProp']; $total['saleBidGoodProp'] += $brokerStatisticsInfo['saleBidGoodProp']; $total['saleBidNewGoodProp'] += $brokerStatisticsInfo['saleBidNewGoodProp']; } /** * 橱窗 */ if ($isShowCaseCity) { $brokerStatisticsInfo['props_sum'] = $adPriceInfo[$date]['propsSum']; $brokerStatisticsInfo['quantity_count'] = $adClickInfo[$date]['quantity_count']; $brokerStatisticsInfo['price'] = $adPriceInfo[$date]['price']; $total['props_sum'] += $adPriceInfo[$date]['propsSum']; $total['quantity_count'] += $adClickInfo[$date]['quantity_count']; $total['price'] += $adPriceInfo[$date]['price']; } $brokerStatisticsInfoList[$date] = $brokerStatisticsInfo; } $BrokerWorkLogInfo = array('data' => array_reverse($brokerStatisticsInfoList), 'total' => $total); $pageParams['BrokerWorkLogInfo'] = $BrokerWorkLogInfo; return $pageParams; }
/** * 精选房源管理页逻辑: * ^/user/choice/manage/(.*) 页面的URL 正则,如果 (.*) 部分 默认跳转到 二手房的 精选房源 管理页面 * * @return bool|string */ public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect_to_login(); } /** * @var AJKRequest $request */ $request = APF::get_instance()->get_request(); $response = APF::get_instance()->get_response(); $params = $this->getParameters(); $route_matches = $request->get_router_matches(); $cityId = $request->getBrokerCityId(); if (empty($route_matches) || !isset($route_matches[1])) { APF::get_instance()->get_response()->redirect('/ajkbroker/user/choice/manage/ajk/'); return false; } if (!Bll_City::isChoiceCity($cityId)) { $response->redirect('/user/combo/brokerhome'); } $business = trim($route_matches[1], "/ \t\n\r\v"); $isChoiceCity = false; switch ($business) { case 'ajk': $isChoiceCity = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE); break; case 'hz': $isChoiceCity = Bll_City::isChoiceCity($cityId, Const_Site::HAOZU); break; case 'jp': $isChoiceCity = Bll_City::isChoiceCity($cityId, Const_Site::JINPU); break; } if (!$isChoiceCity) { $response->redirect('/user/combo/brokerhome?from=not_choice_city'); return false; } switch ($business) { case 'ajk': $pageAttributes = Bll_Plan_Bid_Choice::esf_init_manage($request->getBrokerId(), $request->getBrokerCityId(), $params); break; case 'hz': $pageAttributes = Bll_Plan_Bid_Choice::hz_init_manage($request->getBrokerId(), $request->getBrokerCityId(), $params); break; case 'jp': $pageAttributes = Bll_Plan_Bid_Choice::jp_init_manage($request->getBrokerId(), $request->getBrokerCityId(), $params); break; default: APF::get_instance()->get_response()->redirect('/ajkbroker/user/choice/manage/ajk/?from=error_business_type'); return false; } $request->set_attribute('isChoice', $isChoiceCity); $request->set_attribute('isShowCaseCity', Bll_City::isShowCaseCity($cityId)); $request->set_attribute('business', $business); $request->set_attribute('broker', self::$BrokerInfo); $this->set_attributes($pageAttributes); switch ($business) { case 'ajk': return "Choice_ManageAjk"; break; case 'hz': return "Choice_ManageHz"; break; case 'jp': return "Choice_ManageJp"; default: return false; } }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->redirect('/user/combo/brokerhome'); exit; } $objRequest = APF::get_instance()->get_request(); $cityID = self::$BrokerInfo['BaseInfo']['CITYID']; $objRequest->set_attribute('PayType', self::$BrokerInfo['BaseInfo']['PAYTYPE']); $tmp = array('cityId' => $cityID, 'status' => 1, 'startDate' => date('Ymd')); $cityPrice = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, Const_ShowcaseOrders::SALE_DB); $todayPrice = round($cityPrice->discountPrice / 100, 2); $intBrokerID = $objRequest->getBrokerId(); $userId = $objRequest->getUserId(); $data = array('brokerId' => $intBrokerID); $orderinfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders($data, $this->db); if (!$orderinfo) { $this->toManage('/ajkbroker/showcase/esf/'); } $lavedays = ceil((strtotime($orderinfo->endDate) - strtotime(date('Ymd'))) / 3600 / 24); if ($orderinfo->isStop == 1 || $lavedays < 0) { $order_status = 'stop'; } else { $objRequest->set_attribute('lavedays', $lavedays); $objRequest->set_attribute('lastday', date('Y-m-d', strtotime($orderinfo->endDate))); $order_status = 'open'; } $objRequest->set_attribute('order_status', $order_status); $objRequest->set_attribute('todayPrice', $todayPrice); $params = APF::get_instance()->get_request()->get_parameters(); $days = intval($params['days']); //status=2是停止,status=1是续费 if ($params['status'] == 2) { if ($orderinfo->isStop == 0) { $stopstatus = Bll_Broker_ShowcaseOrders::getInstance()->stopBrokerOthers($orderinfo, $cityPrice->discountPrice, $this->db); if ($stopstatus['status']) { $this->toManage(); } else { $this->toError($stopstatus['msg']); } } else { $msg = '订单类型不能操作'; $this->toError($msg); } } elseif ($params['status'] == 1 && $days >= 1) { $BrokerMoney = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId); if ($BrokerMoney < $todayPrice) { $this->toError(Const_ShowcaseOrders::MONEY_NOT_ENOUGH); } $Continueorder = Bll_Broker_ShowcaseOrders::getInstance()->continueBrokerOthers($orderinfo, $days, $cityPrice->discountPrice, $this->db); if ($Continueorder['status']) { $this->toManage(); } else { $this->toError($Continueorder['msg']); } } elseif ($params['status'] == 3) { $proIds = array(); if (!empty($params['rooms'])) { $proIds = explode(';', $params['rooms']); $filterProIds = Bll_Broker_ShowcaseAdSetPro::getInstance()->filterProIds($intBrokerID, $cityID, $this->db, $proIds); //有些房源不在线上展示 if (count($filterProIds) != count($proIds)) { $this->toError('有些房源没在线上推广,操作失败!'); } $res = Bll_Broker_ShowcaseAdSetPro::getInstance()->insertAdProsInfo($intBrokerID, $cityID, $proIds, $this->db); if (!$res['status']) { $this->toError($res['msg']); } else { //插入成功,跳转至管理页面 if ($orderinfo->isStop == 0) { $log = array(); $log['brokerId'] = $orderinfo->brokerId; $log['cityId'] = $orderinfo->cityId; $log['endDate'] = $orderinfo->endDate; $log['startDate'] = $orderinfo->startDate; $log['opType'] = Const_ShowcaseOrders::OPTYPE_6; $log['totalDays'] = ceil((strtotime($orderinfo->endDate) - strtotime($orderinfo->startDate)) / 3600 / 24) + 1; $log['createTime'] = time(); Bll_Broker_ShowcaseOrders::getInstance()->insertSetLog($log, $this->db); } $this->toManage(); } } } $orderCreated = date('Ymd', $orderinfo->createTime); if ($orderCreated < date('Ymd')) { $click = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerClick($intBrokerID, date('Ymd', strtotime('-1 days')), $this->db); if (!$click->quantityCount) { $objRequest->set_attribute('YClick', 0); } else { $objRequest->set_attribute('YClick', $click->quantityCount); } $objRequest->set_attribute('IS_YClick', true); } $isCombo = Bll_Combo_HouseRelation::isComboCity($cityID); if ($isCombo['data']) { $comboList = Bll_Combo_HouseRelation::getHouseRelations($intBrokerID, Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1); if (!empty($comboList)) { if (count($comboList) >= Const_ShowcaseOrders::SALE_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($comboList); } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdSalePropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proInfos = Bll_House_EsfHouse::getHouseInfo($proIds, $cityID); $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initComboEsfProData($proInfos, $comboList); } else { //获取经纪人计划 $brokerPlanInfo = BLL_Plan_EsfPropFixedPlanRelation::get_instance()->getBrokerEsfOnlinePlan($intBrokerID); if (!empty($brokerPlanInfo)) { //计划数据不为空 //计划IDs $planIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($brokerPlanInfo, 'id'); //定价推广房源 $fixedProInfos = Bll_Fixedspread_AjkFixedSpread::getFixedOnlineProByPlanIds($cityID, $planIds); $proIdsc = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($fixedProInfos, 'proId'); $proInfosc = Bll_House_EsfHouse::getHouseInfo($proIdsc, $cityID); if (!empty($proInfosc)) { if (count($proInfosc) >= Const_ShowcaseOrders::SALE_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($proInfosc); } } else { $fixedProInfosCnt = 0; } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdSalePropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proInfos = Bll_House_EsfHouse::getHouseInfo($proIds, $cityID); $proStatus = Bll_Fixedspread_AjkFixedSpread::getFixedProBy($cityID, $proIds); $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initEsfProData($proInfos, $proStatus, $planIds); } if (count($proList) > $fixedProInfosCnt) { $fixedProInfosCnt = count($proList); } $objRequest->set_attribute('type', 'ajk'); $objRequest->set_attribute('index', 2); //精选推广开关 $isChoice = Bll_City::isChoiceCity($cityID); $objRequest->set_attribute('isChoice', $isChoice); $objRequest->set_attribute('fixedProInfosCnt', $fixedProInfosCnt); $objRequest->set_attribute('proList', $proList); return 'Showcase_EsfManage'; }
/** * @param Manage_ProplistController $controller * @param AJKRequest $request * @param AJKResponse $response * * @return array */ public static function getComboInfo($controller, $request, $response) { $cityId = $request->getBrokerCityId(); $brokerId = $request->getBrokerId(); $query = $request->get_parameter('q'); $pageParams = array('query' => $query); if (!empty($query)) { $pageParams['searchByCommunity'] = !is_numeric($query); } /** 套餐信息 */ $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId); //echo "<pre>";print_r($comboInfoList);exit; $currentCombo = array(); $nextCombo = array(); $currentDate = time(); foreach ($comboInfoList as $comboInfo) { $startDate = strtotime($comboInfo['startTime']); $endDate = strtotime($comboInfo['endTime']); /** 获取当前使用的套餐 */ if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) { $currentCombo = $comboInfo; } /** 获取续买套餐 */ if ($comboInfo['salePropNum'] > 0 && $startDate > $currentDate) { if (!empty($nextCombo)) { $nextComboEffectTime = strtotime($nextCombo['startTime']); if ($nextComboEffectTime > $startDate) { $nextCombo = $comboInfo; } } else { $nextCombo = $comboInfo; } } } $pageParams['currentCombo'] = $currentCombo; $pageParams['nextCombo'] = $nextCombo; $pageParams['comboCanSpreadHouseCount'] = 0; if (!empty($currentCombo)) { if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { $hzSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_HZ); $pageParams['comboCanSpreadHouseCount'] = max(0, $currentCombo['salePropNum'] + $currentCombo['rentPropNum'] - $hzSpreadHouseCount); } else { $pageParams['comboCanSpreadHouseCount'] = $currentCombo['salePropNum']; } } $pageParams['comboClick'] = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK); $isChoiceCity = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE); $isBlockChoiceCity = Bll_City::isBlockChoice($cityId, Const_Site::ANJUKE); /** 精选城市 */ if ($isChoiceCity) { $pageParams['bidTip'] = '精选'; } $pageParams['isChoiceCity'] = $isChoiceCity; $pageParams['isBlockChoiceCity'] = $isBlockChoiceCity; $pageParams['isBidCity'] = false; $pageParams['isShowCaseCity'] = Bll_City::isShowCaseCity($cityId, Const_Site::ANJUKE); /** 获取竞价计划信息 */ if ($isChoiceCity) { $bidPropIds = array(); $pageParams['bidPlanList'] = static::getBrokerBidPlanList($brokerId, $cityId, $bidPropIds, true); $pageParams['bidPropIds'] = $bidPropIds; $pageParams['bidClickCount'] = Bll_Plan_Bid_AjkPlan::getBrokerBidClick($brokerId, date('Ymd'), $cityId); $pageParams['bidCost'] = Bll_Plan_Bid_AjkPlan::getBrokerBidCost($brokerId, date('Ymd'), $cityId); } /** 获取套餐推广信息 */ $comboSpreadHouseList = static::getComboSpreadHouseList($brokerId, $cityId); $pageParams['comboSpreadHouseList'] = $comboSpreadHouseList; $pageParams['comboHouseIds'] = array_keys($comboSpreadHouseList); /** 速度优化:effectURL 没有在房源管理页使用,所以这个是可以删除的 */ // if (!empty($comboSpreadHouseList)) { // TODO 获取效果时时看链接 // $pageParams['effectURL'] = Bll_Plan_Fix_AjkPlan::GetPlanFixedPriceDetailUri($pageParams['fixPlanPropList'][0]['planInfo']['id'], 0, 1); // } $houseInfoList = static::getBrokerAllPropInfoList($brokerId, $cityId, $pageParams['comboHouseIds'], $bidPropIds, $pageParams['isChoiceCity'], $query); //echo "<pre>";print_r($houseInfoList);exit; /** 房源质量信息 */ //$pageParams['houseSolly'] = static::getHouseSollyResult($houseInfoList['houseIdList']); $pageParams['houseSolly'] = static::getHouseSollyResultEx($houseInfoList); $pageParams['comboHouseIds'] = array_values(array_intersect($pageParams['comboHouseIds'], array_keys($houseInfoList['comboSpreadHouseList']))); if ($isChoiceCity) { $houseBidInfoList = array(); $houseBidStatus = array(); foreach ($pageParams['bidPlanList'] as $bidInfo) { $houseBidInfoList[$bidInfo['propId']] = $bidInfo; $houseBidStatus[$bidInfo['propId']] = $bidInfo['status']; if ($bidInfo['model'] == Model_Plan_EsfAjkPropSpread::BLOCK_CHOICE) { $pageParams['planInfoUrl'][$bidInfo['propId']]['urlChoice'] = "/ajkbroker/user/ajax/blockchoice"; } else { $pageParams['planInfoUrl'][$bidInfo['propId']]['urlChoice'] = "/ajkbroker/user/ajax/choice"; } } $pageParams['houseBidStatus'] = $houseBidStatus; $houseInfoList['comboSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['comboSpreadHouseList'], $houseBidInfoList, $cityId); if (Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE)) { $houseInfoList['noSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['noSpreadHouseList'], $houseBidInfoList, $cityId); } // print_r($houseInfoList['noSpreadHouseList']); } /** 精选引导优化 (精选城市 && 已经购买了套餐 && 推广房源数>0) */ $choiceFunctionOptimizationGuide = false; /* if ($isChoiceCity && (!empty($currentCombo) || !empty($nextCombo)) && (count($comboSpreadHouseList) > 0)) { if (Bll_Broker_AjkBrokerGuideNew::getGuideStatus($brokerId, 'Choice_Function_Optimization') == 0) { $choiceFunctionOptimizationGuide = true; } } */ $pageParams['choiceFunctionOptimizationGuide'] = $choiceFunctionOptimizationGuide; //echo "<pre>";print_r(array_keys($houseInfoList));exit; return array_merge($pageParams, $houseInfoList); }