Ejemplo n.º 1
0
 public function handle_request_internal()
 {
     $brokerIds = explode(',', $this->_params['brokerIds']);
     $cityId = $this->_params['cityId'];
     $renovateTime = $this->_params['renovateTime'];
     //某时间以后创建的房源数量
     $isComboCity = Bll_City::isComboCity($cityId);
     $propIds = array();
     if ($isComboCity) {
         //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId);
         $propIds = array_keys($comboSpreadHouseList);
     } else {
         //如果是定价城市 获取经纪人定价计划--获取有效计划房源关系
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerIds);
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanIds = array_keys($fixSpreadPlanList);
         //获取有效计划房源关系
         $relations = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerIds, $cityId, $fixSpreadPlanIds);
         foreach ($relations as $relation) {
             $propIds[] = $relation['propId'];
         }
     }
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfoByGetAll($propIds, $cityId, array(), '', '', $renovateTime);
     $brokerNewPropNum = count($propsInfos);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerNewPropNum' => $brokerNewPropNum));
 }
Ejemplo n.º 2
0
 /**
  * 获取经纪人的定价计划信息
  *
  * @param int $brokerId
  * @param int $cityId
  * @param array $propIds
  * @param int $brokerCheckState
  * @return array
  */
 public static function getBrokerFixPlanList($brokerId, $cityId, &$propIds, $brokerCheckState = 1)
 {
     $rtn = array();
     $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId);
     if (empty($fixSpreadPlanList)) {
         return $rtn;
     }
     if (!is_array($propIds)) {
         $propIds = array();
     }
     $balance = static::getAccountBalance($brokerId);
     $date = date('Ymd');
     foreach ($fixSpreadPlanList as $fixSpreadPlan) {
         $fixPlanId = $fixSpreadPlan['id'];
         // $dayCost = Bll_Ppc_ServiceAPI::planTodayNewCost($fixPlanId);
         // $fixSpreadPlan['dayCost'] = $dayCost['allAmount'] ? $dayCost['allAmount'] : 0;
         $dayCost = Bll_Ppc_ServiceAPI::brokerDailyFixCost($brokerId, $fixPlanId, $date, $date);
         $fixSpreadPlan['dayCost'] = max(0, $dayCost) / 100;
         // $fixSpreadPlan['clickTotal'] = $dayCost['allClick'];
         $planDailyClickNum = Bll_Ppc_ServiceAPI::getFixPlanDailyClickNum($brokerId, $fixPlanId, $date, $date);
         $fixSpreadPlan['clickTotal'] = 0;
         if (!empty($planDailyClickNum)) {
             foreach ($planDailyClickNum as $planDailyClick) {
                 $fixSpreadPlan['clickTotal'] += intval($planDailyClick['clickNum']);
             }
         }
         // $fixSpreadPlan['allAgioAmount'] = $dayCost['allAgioAmount'];
         $fixSpreadPlan['balance'] = $balance;
         if ($brokerCheckState != 1) {
             $fixSpreadPlan['flag'] = 6;
         } elseif ($balance <= 0) {
             $fixSpreadPlan['flag'] = 2;
         } elseif ($fixSpreadPlan['viewtime'] <= time()) {
             $fixSpreadPlan['flag'] = 1;
         } elseif ($fixSpreadPlan['viewtime'] == 1893427200) {
             //账户没钱停止的标记(2030年),显示以结束
             $fixSpreadPlan['flag'] = $balance > 0 ? 3 : 2;
         } elseif ($fixSpreadPlan['viewtime'] == 1861891200) {
             //手动停止标记(2029年)
             $fixSpreadPlan['flag'] = 3;
         } elseif ($fixSpreadPlan['ceiling'] <= $fixSpreadPlan['dayCost'] * 100) {
             //限额小于等于花费,限额不足
             $fixSpreadPlan['flag'] = 4;
         } else {
             $fixSpreadPlan['flag'] = 5;
         }
         $planInfo = array('planInfo' => $fixSpreadPlan, 'houseList' => array());
         $propFixedPlanRelationList = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $fixPlanId);
         foreach ($propFixedPlanRelationList as $propFixedPlanRelation) {
             $propIds[] = $propFixedPlanRelation['propId'];
             $planInfo['houseList'][] = $propFixedPlanRelation['propId'];
         }
         $rtn[] = $planInfo;
     }
     return $rtn;
 }
Ejemplo n.º 3
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;
     }
 }
Ejemplo n.º 4
0
 public function handle_request_internal()
 {
     $brokerIds = explode(',', $this->_params['brokerIds']);
     $cityId = $this->_params['cityId'];
     $sinceId = isset($this->_params['sinceId']) ? intval($this->_params['sinceId']) : 0;
     //从$sinceId 行开始读
     $per = isset($this->_params['per']) ? $this->_params['per'] : 10;
     //每页示的条数
     //二手房 房源表查找房源信息 找出所有的 propIds
     $isComboCity = Bll_City::isComboCity($cityId);
     $propIds = array();
     if ($isComboCity) {
         //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId);
         $propIds = array_keys($comboSpreadHouseList);
         $status = 2;
         //2 套餐 1 定价
     } else {
         //如果是定价城市 获取经纪人定价计划--获取有效计划房源关系
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerIds);
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanIds = array_keys($fixSpreadPlanList);
         //获取有效计划房源关系
         $relations = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerIds, $cityId, $fixSpreadPlanIds);
         foreach ($relations as $relation) {
             $propIds[] = $relation['propId'];
         }
         $status = 1;
     }
     //获取房源信息  分页
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array(), $per + 1, $sinceId);
     //板块信息
     $blockCode = array();
     foreach ($propsInfos as $propsInfoVal) {
         $blockCode[] = substr($propsInfoVal['areaCode'], 8, 4);
     }
     $blockInfos = Bll_Community_CommunityGardener::getAreaBlock($blockCode);
     $hasNextPage = 0;
     //是否有下一页
     $brokerProps = array();
     if (!empty($propsInfos)) {
         $hasNextPage = count($propsInfos) > $per ? 1 : 0;
     }
     if ($hasNextPage) {
         array_pop($propsInfos);
         $sinceId += $per;
     } else {
         $sinceId = 0;
     }
     foreach ($propsInfos as $propsInfo) {
         $row = array();
         $row['brokerId'] = $propsInfo['brokerId'];
         $row['propId'] = $propsInfo['proId'];
         $row['cityId'] = $propsInfo['cityId'];
         $row['title'] = $propsInfo['proName'];
         $row['commId'] = $propsInfo['commId'];
         $row['commName'] = $propsInfo['commName'];
         $row['areaCode'] = $propsInfo['areaCode'];
         $row['blockName'] = $blockInfos[$row['areaCode']];
         $row['createTime'] = date("Y-m-d H:i:s", $propsInfo['postDate']);
         $row['room'] = $propsInfo['roomNum'];
         $row['hall'] = $propsInfo['hallNum'];
         $row['toilet'] = $propsInfo['toiletNum'];
         $row['area'] = $propsInfo['areaNum'];
         $row['areaUnit'] = '平米';
         $row['price'] = intval($propsInfo['proPrice']);
         $row['priceUnit'] = '万';
         //获取房源图片
         $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($propsInfo['proId']);
         $houseImageBaseInfos = $houseImageInfo['imageBaseInfo'];
         $houseImageUrls = array();
         if ($houseImageBaseInfos) {
             foreach ($houseImageBaseInfos as $imageInfo) {
                 $houseImageUrls[] = Util_Image::getInstance()->getResizeURL($imageInfo['FILENAME'], $imageInfo['HOST_ID'], 420, 315);
             }
         }
         $row['imageUrls'] = $houseImageUrls;
         $row['status'] = $status;
         $brokerProps[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerProps' => $brokerProps, 'hasNextPage' => $hasNextPage, 'sinceId' => $sinceId));
 }