public function handle_request_internal()
 {
     $brokerPpcLimit = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo(static::$intBrokerID, Bll_Ppc_ServiceAPI::PPC_BROKER_LIMIT_ESF_SITE);
     if (empty($brokerPpcLimit)) {
         echo json_encode(array('status' => 'error'));
     } else {
         echo json_encode(array_merge(array('status' => 'ok'), $brokerPpcLimit));
     }
 }
Example #2
0
 /**
  * @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);
 }
Example #3
0
 /**
  * 判断PPC 经纪人是否可以推广房源
  *
  * @param int $cityId
  * @param int $brokerId
  * @return bool
  */
 public static function ajkPpcBrokerCanSpreadHouse($cityId, $brokerId)
 {
     $houseList = Bll_House_EsfHouse::getFixSpreadHouse($cityId, $brokerId);
     $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId, Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ESF_SITE);
     return $ppcLimitInfo['promotionLimit'] > count($houseList);
 }
Example #4
0
 public function handle_request()
 {
     $brokerList = Model_Broker_AjkBrokerExtend::scanBroker($this->_startId, self::BATCH_LIMIT);
     if (empty($brokerList)) {
         file_put_contents($this->_doneFile, 'YES');
     }
     foreach ($brokerList as $broker) {
         $brokerId = $broker['brokerId'];
         $cityId = $broker['cityId'];
         $this->setCursor($brokerId);
         /** 套餐城市的不予以处理 */
         if (Bll_City::isComboCity($broker['cityId'])) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 是套餐城市,不予处理。', $brokerId, $cityId));
             continue;
         }
         /** 判断经纪人所在城市是否已经开启多档封顶 */
         if (false == Bll_Broker_Manage_AjkPropList::checkSelectLimitTempAvailable($cityId)) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 没有开启多档封顶,不予处理。', $brokerId, $cityId));
             continue;
         }
         /** 获取经纪人城市封顶限额 */
         $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId);
         if (empty($ppcLimitInfo)) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 获取封顶限额失败。', $brokerId, $cityId));
             file_put_contents($this->_errorBroker, $brokerId, FILE_APPEND);
             continue;
         }
         $ppcFixHouseCountLimit = $ppcLimitInfo['promotionLimit'];
         /** 获取经纪人所有的定价计划 */
         $fixPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($broker);
         $fixSpreadHouseList = array();
         foreach ($fixPlanList as $fixPlan) {
             $planId = $fixPlan['id'];
             /** 获取经纪人指定定价计划下房源计划关系 */
             $fixSpreadHouseList = $fixSpreadHouseList + Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $planId);
         }
         $fixSpreadHouseCount = count($fixSpreadHouseList);
         if ($fixSpreadHouseCount <= $ppcFixHouseCountLimit) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,没有多余房源。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount));
             continue;
         }
         $this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,多余[%d]房源下架。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount, $fixSpreadHouseCount - $ppcFixHouseCountLimit));
         /** 测试,不予以处理 */
         file_put_contents('/data1/logs/Repair_Bug46849.test', $brokerId, FILE_APPEND);
         continue;
         $updateTime2IdMapping = array();
         $updateTime = array();
         foreach ($fixSpreadHouseList as $fixSpreadHouse) {
             $intUpdateTime = strtotime($fixSpreadHouse['updatedDatetime']);
             $updateTime[] = $intUpdateTime;
             if (!isset($updateTime2IdMapping[$intUpdateTime])) {
                 $updateTime2IdMapping[$intUpdateTime] = array();
             }
             $updateTime2IdMapping[$intUpdateTime][] = $fixSpreadHouse;
         }
         $updateTime = array_unique($updateTime, SORT_NUMERIC);
         rsort($updateTime, SORT_NUMERIC);
         $relationList = array();
         foreach ($updateTime as $key) {
             $relationList = array_merge($relationList, $updateTime2IdMapping[$key]);
         }
         /** 需要下架的推广房源 */
         $houseList = array_slice($relationList, 0, $fixSpreadHouseCount - $ppcFixHouseCountLimit);
         foreach ($houseList as $house) {
             if (Bll_Ppc_ServiceAPI::deleteHouseFromFixPlan($brokerId, $house['planId'], $house['propId'], 46849)) {
                 $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架成功。', $brokerId, $cityId, $house['propId'], $house['planId']));
                 continue;
             }
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架失败。', $brokerId, $cityId, $house['propId'], $house['planId']));
         }
     }
     if (count($brokerList) < self::BATCH_LIMIT) {
         $this->logMsg(sprintf('startId: %d 处理结束。', $this->_startId));
         file_put_contents($this->_doneFile, 'YES');
         return;
     }
 }
Example #5
0
 /**
  * 获取经纪人封顶相关信息
  *
  * @param int $brokerId
  * @param AJKRequest $request
  * @return array
  */
 private function getBrokerLimitInfo($brokerId, $request)
 {
     // TODO 获取经纪人封顶相关信息
     return Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId, Bll_Ppc_ServiceAPI::PPC_BROKER_LIMIT_ESF_SITE);
 }