private function initEnv() { $this->objAPF = $objAPF = APF::get_instance(); $this->request = $this->objAPF->get_request(); $this->params = $this->request->get_parameters(); $this->brokerId = $this->request->getBrokerId(); $this->cityId = $this->request->getBrokerCityId(); //设置租房、金铺的经纪人id $MainBusiness = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($this->brokerId, false); $this->hzBrokerId = $MainBusiness['hzBrokerid']; $this->jpBrokerId = $MainBusiness['jpBrokerid']; $this->debug = isset($_GET['debug']) ? true : false; }
/** * init env * @param AJKRequest $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(); $out['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($out['ajkBrokerId']); $route_matches = $request->get_router_matches(); $out['proId'] = trim($route_matches[2], "/ \t\n\r\v"); if (!$out['proId']) { throw new Exception('缺少房源Id参数'); } $jpMemberInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']); // 获取金铺brokerId $out['jpBrokerId'] = $jpMemberInfo->id; // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU); $out['isBidCity'] = Bll_City::isBidCity($out['cityId'], Const_Site::JINPU); if ($out['isChoiceCity'] || $out['isBidCity']) { $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价'; $out['bidUrl'] = $out['isChoiceCity'] ? '/ajkbroker/user/choice/set/jp/' . $out['proId'] : '/jinpu/bid/new/' . $out['proId']; } $multicity = APF::get_instance()->get_config("cities", "multicity"); $out['cityName'] = $multicity[$out['cityId']]; // 获取经纪人信息 if (!($out['brokerInfo'] = Model_Broker_JpBroker::data_access()->filter('id', $jpMemberInfo->id)->get_row())) { throw new Exception('获取金铺经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']'); } }
/** * init env * @param AJKRequest $request * @param array $out * @throws Exception */ private static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); $route_matches = $request->get_router_matches(); $out['proId'] = trim($route_matches[2], "/ \t\n\r\v"); if (!$out['proId']) { throw new Exception('缺少房源Id参数'); } // 获取好租brokerId $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']); // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU); $out['isBidCity'] = false; // 获取经纪人信息 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(); }
/** * @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; } } }
/** * @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 handlePost() { $this->request = APF::get_instance()->get_request(); $brokerId = $this->request->getBrokerId(); $cityId = $this->request->getBrokerCityId(); $params = $this->request->get_parameters(); $params['broker_id'] = $brokerId; $result = array(); try { if ($this->action == 'edit') { $houseInfo = Bll_House_EsfEdit::getHouseBaseInfo($this->houseId); /** 违规房源不可以编辑 */ if (isset($houseInfo['isIllegal']) && $houseInfo['isIllegal']) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', 'edit', $this->houseId, '已违规房源不可编辑'); } $result = Bll_House_EsfEdit::saveHouseInfo($brokerId, $cityId, $this->houseId, $params); } if ($this->action == 'publish') { $result = Bll_House_EsfPublish::saveHouseInfo($brokerId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } /** 委托房源发布 */ if ($this->action == 'commission') { $result = Bll_House_EsfCommission::saveHouseInfo($brokerId, $cityId, $this->commissionId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } if ($result['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $result['info']); } } catch (Exception $e) { $params['brokerId'] = self::$intBrokerID; APF::get_instance()->get_nlogger()->log(__CLASS__, $params); $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $e->getMessage()); } /** 立即推广 */ if (isset($params['broker_action']) && $params['broker_action'] == 'publish') { /** 套餐推广 */ if ($this->isComboBroker) { $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, array($this->houseId), Bll_Combo_HouseRelation::SITE_TYPE_AJK); if ($spreadResult['status'] != 1) { switch ($spreadResult['status']) { /** 没有套餐 */ case -1: case -2: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_NO_COMBO, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 套餐未生效 */ /** 套餐未生效 */ case -3: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 推广房源数已满 */ /** 推广房源数已满 */ case -4: case -5: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; default: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_FAIL, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); } } } else { /** 定价推广 */ if ($this->action == 'edit') { /** 定价推广失败 房源已经推广 */ if (BLL_Plan_EsfPropFixedPlanRelation::isHouseOnline($cityId, $this->houseId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_PLAN_IN, 'ajk', $this->action, $this->houseId, '房源已经推广'); } } $fixPlanList = BLL_Plan_EsfPropFixedPlanRelation::getBrokerValidPlan($brokerId); if (empty($fixPlanList)) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', $this->action, $this->houseId, '获取定价计划信息失败'); } $fixPlan = $fixPlanList[0]; /** 定价推广失败 已经超出推广房源上限 */ if (!Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_OUT_LIMIT, 'ajk', $this->action, $this->houseId, '已经超出推广房源上限'); } $spreadResult = Bll_Ppc_ServiceAPI::fixPlanAddHouse($brokerId, $this->houseId, $fixPlan['id'], '23532'); if (isset($spreadResult['status'])) { if ($spreadResult['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, $spreadResult['info']); } } else { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, '系统繁忙(推广房源超时)'); } /** 定价推广失败 计划已经手动停止 */ if ($fixPlan['viewTime'] == 1861891200) { /** 定价推广失败 认证未通过 */ $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId); if ($brokerCheckState != 1) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, 'ajk', $this->action, $this->houseId, '认证未通过'); } $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, 'ajk', $this->action, $this->houseId, '计划已经手动停止'); } /** 定价推广失败 账户余额不足,充值后自动推广 */ if ($fixPlan['viewTime'] == 1893427200) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, 'ajk', $this->action, $this->houseId, '账户余额不足,充值后自动推广'); } } /** 推广成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SPREAD_SUCCESS, 'ajk', $this->action, $this->houseId); } /** 发布成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, 'ajk', $this->action, $this->houseId); }
/** * @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; }
/** * @param House_PropviewController $controller * @param AJKRequest $request * @param AJKResponse $response * * @return array */ public static function handlerPropViewRequest($controller, $request, $response) { $routeMatches = $request->get_router_matches(); $houseId = $routeMatches[2]; $cityId = $request->getBrokerCityId(); $brokerId = $request->getBrokerId(); $pageParams = array('houseId' => $houseId); $houseInfo = Bll_House_EsfHouse::getHouseBaseInfoEx($houseId, $cityId); /** 不是当前经纪人的房源则返回到房源管理页去 */ if (empty($houseInfo) || $houseInfo['brokerId'] != $brokerId) { $response->redirect('/ajkbroker/user/manage/proplist/ajk/'); } $pageParams['title'] = $houseInfo['proName']; $houseInfo['mobile'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $pageParams['info'] = sprintf('%s %d平米,%d室%d厅%d卫,%d/%d层,%.2f万 (房源ID:%d)', $houseInfo['commName'], $houseInfo['areaNum'], $houseInfo['roomNum'], $houseInfo['hallNum'], $houseInfo['toiletNum'], $houseInfo['proFloor'], $houseInfo['floorNum'], $houseInfo['proPrice'], $houseId); $currentDate = strtotime(date('Y-m-d 00:00:00')); $postDate = strtotime(date('Y-m-d 00:00:00', $houseInfo['postDate'])); $pageParams['leftDay'] = max(0, 90 - floor(($currentDate - $postDate) / 86400)); $pageParams['houseInfo'] = $houseInfo; $pageParams['viewLink'] = Util_Url::ajkHouseDetailUrl($houseId, $cityId); $pageParams['editURL'] = Bll_Ppc_LinkManager::getSaleEditUrl($houseId); $houseAdShow = Model_House_AdPropShowSale::getHouseAdSale($brokerId, $houseInfo['proId']); $pageParams['AdShow'] = empty($houseAdShow) ? false : true; $pageParams['isIllegal'] = $houseInfo['isVisible'] == 0 && $houseInfo['expireWorker'] != 'propertyReport'; // TODO 获取小区在线房源和排名 需要重构 $pageParams['communitySaleCount'] = Model_Community_AjkSaleRentCount::getCommunitySaleNum($houseInfo['commId']); $isBidCity = Bll_City::isBidCity($cityId); if ($isBidCity) { $pageParams['bidTip'] = '竞价'; } $isChoiceCity = Bll_City::isChoiceCity($cityId); /** 精选城市 */ if ($isChoiceCity) { $pageParams['bidTip'] = '精选'; } $pageParams['isChoiceCity'] = $isChoiceCity; $pageParams['isBidCity'] = $isBidCity; $houseRank = Bll_Broker_Manage_AjkPropList::getHouseSollyResult(array($houseId)); if (isset($houseRank[$houseId])) { $pageParams['houseRank'] = $houseRank[$houseId]; } else { $pageParams['houseRank'] = '待评'; } $houseSpreadDate = array(); for ($interval = -6; $interval <= 0; $interval++) { $houseSpreadDate[] = date('m.d', strtotime("{$interval} day")); } $pageParams['houseSpreadDate'] = $houseSpreadDate; $fixPlanId = Bll_Plan_Fix_AjkPlan::getPlanIdByHouseId($brokerId, $houseId, $cityId); $startDate = date('Ymd', strtotime('-6 day')); $endDate = date('Ymd'); $houseFixDailyCostList = array(); for ($i = -6; $i <= 0; $i++) { $date = date('m.d', strtotime("{$i} day")); $houseFixDailyCostList[$date] = 0; } /** 获取房源指定日期内每天的定价点击 */ if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $pageParams['houseFixSpreadClickInfoList'] = static::getHouseComboSpreadClickInfo($houseId); } else { $pageParams['houseFixSpreadClickInfoList'] = static::getHouseFixSpreadClickInfoEx($brokerId, $houseId); /** 获取房源指定日期内每天的定价花费 */ $pageParams['houseFixDailyCostList'] = array_merge($houseFixDailyCostList, static::getHouseFixDailyCost($brokerId, $fixPlanId, $houseId, $startDate, $endDate)); } if ($isChoiceCity || $isBidCity) { $houseBidSpreadInfo = static::getHouseBidSpreadInfo($houseId, $cityId); $pageParams['houseBidSpreadInfo'] = $houseBidSpreadInfo; } // $pageParams['houseDetail'] = Bll_Ppc_ServiceAPI::getHouseInfo($houseId); $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($houseId); $pageParams['optimize'] = static::getHouseOptimizeInfo($houseId, $houseImageInfo, $houseInfo, $cityId); $pageParams['imageCount'] = count($houseImageInfo['imageBaseInfo']); if (count($houseImageInfo['imageBaseInfo']) <= 0) { $pageParams['houseDefaultImage'] = 'http://pages.anjukestatic.com/img/global/nopic_150x113.gif'; } else { $pageParams['houseDefaultImage'] = static::getThumbImageUrl($houseId, $houseImageInfo['imageBaseInfo']); } $pageParams['houseStatisticsInfo'] = static::getHouseStatisticsInfo($houseId, $cityId, $houseInfo['commId'], $houseInfo['proPriceInt']); //市场分析,小区价格段供需比。获取前天的数据 $pageParams['demandSupplyPriceInfo'] = static::getDemandSupplyByPriceInfo($houseInfo['commId']); //市场分析,小区户型供需比。获取前天数据 $pageParams['demandSupplyRoomInfo'] = static::getCommTotalRoomInfo($houseInfo['commId']); $pageParams['subRegionRank'] = static::getCommunityRank($houseInfo['areaCode'], $houseInfo['commId']); return $pageParams; }
/** * @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); }