Example #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));
 }
Example #2
0
 public function handle_request_internal()
 {
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     /**
      * @var $response AJKResponse
      */
     $response = APF::get_instance()->get_response();
     $response->set_content_type('application/json', 'utf-8');
     if (!Bll_City::isComboCity($request->getBrokerCityId())) {
         echo json_encode(array('status' => 'error', 'msg' => '非套餐城市'));
         return false;
     }
     $params = $this->getParameters();
     $routeMatches = $request->get_router_matches();
     if (!isset($routeMatches[1])) {
         $action = 'NotFoundAction';
     } else {
         $action = str_replace(' ', '', ucwords(str_replace('_', ' ', $routeMatches[1])));
         $action = $action . 'Action';
     }
     if (!method_exists($this, $action) || !is_callable(array($this, $action))) {
         $action = 'NotFoundAction';
     }
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $result = call_user_func(array($this, $action), $brokerId, $cityId, $params);
     echo json_encode($result);
     return false;
 }
Example #3
0
 public function beforeHandlerRequest()
 {
     /** 不是套餐城市就直接返回 */
     if (!Bll_City::isComboCity($this->cityId)) {
         $this->outPut(0, '未开通套餐业务');
         exit;
     }
 }
 public function handle_request_internal()
 {
     $app = $this->_params['app'];
     $cv = $this->_params['cv'];
     $cityId = $this->_params['cityId'];
     $brokerId = isset($this->_params['brokerId']) ? $this->_params['brokerId'] : 0;
     if ($app == 'i-broker2' && $cv == 4.3) {
         if (Bll_City::isBidCity($cityId)) {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID);
         } else {
             if (Bll_City::isChoiceCity($cityId)) {
                 $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE);
             } else {
                 $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_NOTCHOICE_NOTBID, 'businessTypeName' => self::RETURN_CODE_MSG_NOTCHOICE_NOTBID);
             }
         }
     } else {
         if (Bll_City::isBidCity($cityId)) {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID);
         } else {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE);
         }
     }
     //查询房源库权限
     //$brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     //$fykStatus = V1_Fyk_User_PrivilegesController::getFykStatus($brokerInfo->userId,$cityId);
     $fykStatus = array('isOpen' => 0, 'status' => -1, 'message' => '房源库功能已关闭');
     $return['fykStatus'] = $fykStatus;
     //获取是否试套餐城市
     $timeBool = Model_Combo_BusinessUseConfig::getCityComboConfig($cityId);
     if (Bll_City::isComboCity($cityId) && !empty($timeBool) && time() > $timeBool['startTime']) {
         $return['comboBusinessType']['businessTypeId'] = self::RETURN_COMBO_CITY_NUM_YES;
         $return['comboBusinessType']['businessTypeName'] = self::RETURN_COMBO_CITY_MSG_YES;
         if ($brokerId) {
             $result = Bll_Broker_HzBroker::isComboBroker($brokerId);
             if ($result === false) {
                 $return['updateComboBusiness']['isUpdateToComboBusiness'] = 1;
                 $return['updateComboBusiness']['updateMessage'] = '移动经纪人由定价模式升级为套餐模式,立即切换使用吧!';
             } else {
                 $return['updateComboBusiness']['isUpdateToComboBusiness'] = 0;
                 $return['updateComboBusiness']['updateMessage'] = '';
             }
         }
     } else {
         $return['comboBusinessType'] = array('businessTypeId' => self::RETURN_COMBO_CITY_NUM_NO, 'businessTypeName' => self::RETURN_COMBO_CITY_MSG_NO);
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
Example #5
0
 public function beforeHandlerRequest()
 {
     if (!$this->params['brokerId']) {
         $this->outPut(0, '参数缺失');
     }
     // 获取经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::getDataByBrokerId($this->params['brokerId']);
     $this->params['cityId'] = $brokerInfo->cityId;
     $this->params['userId'] = $brokerInfo->userId;
     /** 不是套餐城市就直接返回 */
     if (!Bll_City::isComboCity($this->params['cityId'])) {
         $this->outPut(0, '未开通套餐业务');
     }
     /** 不是套餐经纪人直接返回 */
     if (!Bll_Broker_HzBroker::isComboBroker($this->params['brokerId'])) {
         $this->outPut(0, '不是套餐经纪人');
     }
 }
 public function handle_request()
 {
     $loadFields = array('proId', 'brokerId');
     $houseList = Bll_House_EsfHouse::scanInvalidateHouse($this->_cityId, $this->_startId, self::DEAL_LIMIT, $loadFields);
     if (count($houseList) < self::DEAL_LIMIT) {
         $this->dealDone(true);
     } else {
         $this->dealDone(false);
     }
     foreach ($houseList as $house) {
         $houseId = $house['proId'];
         $brokerId = $house['brokerId'];
         $this->setCursor($houseId);
         /** 套餐城市 */
         if (Bll_City::isComboCity($this->_cityId)) {
             $spreadRelation = Bll_Combo_HouseRelation::getRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
             if (empty($spreadRelation)) {
                 $this->logMsg(sprintf('没有获取到房源[%d]的套餐推广关系[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
                 continue;
             }
             if ($spreadRelation['brokerId'] != $brokerId || $spreadRelation['cityId'] != $this->_cityId) {
                 $this->logMsg(sprintf('房源[%d]的 [BrokerId=%d CityId=%d] xxxx [BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId, $spreadRelation['brokerId'], $spreadRelation['cityId']));
                 $this->saveErrorHouseId($houseId, $brokerId);
                 continue;
             }
             $this->logMsg(sprintf('房源[%d]的套餐推广关系正确[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
         } else {
             $spreadRelation = Model_Plan_AjkFixRelation::getRelationByProIdEx($houseId, $this->_cityId);
             if (empty($spreadRelation)) {
                 $this->logMsg(sprintf('没有获取到房源[%d]的定价推广关系[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
                 continue;
             }
             if ($spreadRelation['brokerId'] != $brokerId) {
                 $this->logMsg(sprintf('房源[%d]的 [BrokerId=%d CityId=%d] 关系的 [BrokerId=%d]', $houseId, $brokerId, $this->_cityId, $spreadRelation['brokerId']));
                 $this->saveErrorHouseId($houseId, $brokerId);
                 continue;
             }
             $this->logMsg(sprintf('房源[%d]的定价推广关系正确[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
         }
     }
 }
Example #7
0
 public function beforeUpDownWorkerHandler()
 {
     if (empty($this->params['broker_id'])) {
         throw new Exception_BllErrorException('broker_id 为空');
     }
     if (empty($this->params['pro_id'])) {
         throw new Exception_BllErrorException('房源ID为空');
     }
     $this->params['ajk_broker_id'] = $this->params['broker_id'];
     // 获取好租brokerid
     if (!($this->params['broker_id'] = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->params['broker_id']))) {
         throw new Exception_BllErrorException('获取好租经纪人失败');
     }
     // 是否套餐经纪人
     //$this->params['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($this->params['ajk_broker_id']);
     $this->params['isComboCity'] = Bll_City::isComboCity($this->params['city_id']);
     // 房子非空判断
     if (!Bll_HzProp::get_prop($this->params['pro_id'], true)) {
         throw new Exception_BllErrorException('房源' . $this->params['pro_id'] . '不存在');
     }
 }
Example #8
0
 public function handle_request_internal()
 {
     $app = $this->_params['app'];
     $cv = $this->_params['cv'];
     $cityId = $this->_params['cityId'];
     // 基础业务类型 • 老端口
     $isDuankou = Bll_City::isDuankouCity($cityId);
     // 基础业务类型 • 定价
     $isFix = Bll_City::isFixCity($cityId);
     // 基础业务类型 • 新套餐
     $isCombo = Bll_City::isComboCity($cityId);
     // 增值业务类型 • 竞价
     $isBid = Bll_City::isBidCity($cityId);
     // 增值业务类型 • 精选
     $isChoice = Bll_City::isChoiceCity($cityId);
     if ($app == 'i-broker2' && $cv == 4.3) {
         if (!$isBid) {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('isDuankou' => intval($isDuankou), 'isFix' => intval($isFix), 'isCombo' => intval($isCombo), 'isChoice' => intval($isChoice)));
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('isDuankou' => intval($isDuankou), 'isFix' => intval($isFix), 'isCombo' => intval($isCombo), 'isBid' => intval($isBid), 'isChoice' => intval($isChoice)));
 }
 public function handle_request()
 {
     $cityIds = $this->getOption('city', array());
     if (empty($cityIds)) {
         $this->logMsg('Usage: launcher.php Combo_AjkCheckHouseForSolr --city=... [--release=...] [--action=[scan | deal]]');
         return;
     }
     $cityIdList = explode(',', $cityIds);
     $dealCityIdList = array();
     foreach ($cityIdList as $cityId) {
         if (false == Bll_City::isComboCity($cityId)) {
             $this->logMsg(sprintf('城市:%d 不是套餐城市,不予处理。', $cityId));
             continue;
         }
         $dealCityIdList[] = $cityId;
     }
     $action = $this->getOption('action', 'scan');
     if (strcasecmp('scan', $action) == 0) {
         $this->dealScan($dealCityIdList);
     } else {
         $this->dealFailureHouse();
     }
 }
Example #10
0
 public function dealTask($task)
 {
     $solrOnProId = $task['id'];
     //1:老端口房源(安居客经纪人发的租房房源)
     //3:租房经纪人房源
     //0:个人房源
     $from = $task['from'];
     if ($from == 1) {
         return true;
     }
     // 查主表获取cityId 如果没有则标记邮件发出
     $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($solrOnProId);
     if ($propInfo && $propInfo['contentBasic']['status'] == 1) {
         $this->proceLog .= 'remark 房源推广中';
         return true;
     }
     // 房源没有或者不在线 通知solr下  且发邮件
     $type = 2;
     if ($from == 0) {
         $type = 1;
     }
     // 个人房源
     // 如果新端口 走中间件
     if (Bll_City::isComboCity($task['city_id'])) {
         Bll_Combo_NoticeSolrUpDown::noticeComboSolrHzAPI($task['city_id'], $propInfo['contentBasic']['userid'], $solrOnProId, 2, $type);
     } else {
         Dao_Broker_HzProp::into_prop_lucene($solrOnProId, $task['city_id'], 2, $type);
     }
     if (empty($propInfo)) {
         $this->proceLog .= 'remark 房源未找到';
         $this->emptyPropIds[] = $solrOnProId;
     } else {
         $this->proceLog .= 'remark 房源非推广 status:' . $propInfo['contentBasic']['status'];
         $this->errorPropIds = $solrOnProId;
     }
     return true;
 }
Example #11
0
 /**
  * 108 房源价格变更
  *
  * <ol>
  * <li>
  * 查询房源信息是否存在<br>
  *      如果不存在,返回结束<br>
  *      如果存在,记录房源编辑日志<br>
  * </li>
  *
  * <li>
  * 查询房源计划关系<br>
  *      如果不存在,返回结束<br>
  *      如果存在,重新计算定价的底价并更新计划关系表中的底价<br>
  * </li>
  *
  * <li>
  * 查询计划信息<br>
  *      如果计划不在推广,返回结束<br>
  *      如果计划正在推广或者第二天推广, 记录房源更新日志<br>
  * </li>
  *
  * <li>
  * 竞价rebuild(暂未处理)
  * </li>
  * </ol>
  */
 public static function change_prop_price($params)
 {
     $returnLog = array();
     array_push($returnLog, '队列(' . json_encode($params['id']) . ')开始处理');
     if (empty($params['pro_id'])) {
         array_push($returnLog, '房源ID为空');
         return self::build_return(1, $returnLog);
     }
     if (empty($params['city_id'])) {
         array_push($returnLog, '城市ID为空');
         return self::build_return(1, $returnLog);
     }
     if (empty($params['remark'])) {
         array_push($returnLog, "remark为空");
         return self::build_return(1, $returnLog);
     }
     $remark = json_decode($params['remark']);
     if (empty($remark->oldPrice)) {
         array_push($returnLog, 'oldPrice为空');
         return self::build_return(1, $returnLog);
     }
     if (empty($remark->price)) {
         array_push($returnLog, 'price为空');
         return self::build_return(1, $returnLog);
     }
     //获取房源信息
     $propBll = new BLL_Property_Property();
     $propInfo = $propBll->getPropBaseInfoById($params['pro_id']);
     if (isset($propInfo[-9999])) {
         array_push($returnLog, '获取数据库中房源信息失败');
         return self::build_return(0, $returnLog);
     }
     if (empty($propInfo)) {
         array_push($returnLog, '房源信息为空');
         return self::build_return(1, $returnLog);
     }
     //房源信息存在写入房源编辑信息
     $data = self::build_prop_log($params, 2, json_encode(array("oldPrice" => $remark->oldPrice, "newPrice" => $remark->price, "msg" => "房源编辑" . ";队列表id为" . $params['id'])), $params['broker_id']);
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         array_push($returnLog, "房源编辑日志写入失败");
         return self::build_return(0, $returnLog);
     }
     array_push($returnLog, "房源编辑日志写入");
     /**
      * 新端口城市
      */
     if (Bll_City::isComboCity($params['city_id'])) {
         $houseRelationList = Bll_Combo_HouseRelation::getHouseRelation($params['broker_id'], $params['city_id'], array($params['pro_id']), Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         if (empty($houseRelationList)) {
             $returnLog[] = '房源套餐关系为空';
             return self::build_return(1, $returnLog);
         }
         foreach ($houseRelationList as $houseRelation) {
             if (Bll_Combo_HouseRelation::isRelationOnline($houseRelation['state'])) {
                 $data = self::build_prop_log($params, 4, '房源更新;队列表id为' . $params['id'], $params['broker_id']);
                 if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                     $returnLog[] = '房源更新日志写入失败';
                 } else {
                     $returnLog[] = '房源更新日志写入成功';
                 }
             }
         }
         return self::build_return(1, $returnLog);
     }
     //查询房源计划关系
     $relationBll = new Bll_FixedSpread_PropFixedPlanRelation();
     $relationInfo = $relationBll->getProSpreadRelationByProId($params['pro_id'], $params['city_id']);
     if (empty($relationInfo)) {
         array_push($returnLog, '房源计划关系为空');
         return self::build_return(1, $returnLog);
     }
     /**
      * 修正房源的计划id
      */
     if (empty($params['plan_id'])) {
         $params['plan_id'] = $relationInfo['PlanId'];
     }
     //定价底价rebuild并更新关系表底价
     if (BLL_Fixedspread_StaticPlanUpDownSwicher::isOnline()) {
         $fixedBll = new Bll_Fixedspread_AjkFixedSpread();
         $result = $fixedBll->rebulidStaticPro($relationInfo['Id'], $params['city_id'], $remark->price);
         if ($result != true || (string) $result == '未知价格区间') {
             if ($result == '未知价格区间') {
                 array_push($returnLog, '定价底价rebuild失败,未知价格区间');
             } else {
                 array_push($returnLog, '定价底价rebuild失败');
             }
             return self::build_return(0, $returnLog);
         }
         array_push($returnLog, '定价底价rebuild成功,oldPrice(' . $remark->oldPrice . ')=>price(' . $remark->price . ')');
     }
     /** 判断计划关系状态 */
     if ($relationInfo['Status'] != 1) {
         array_push($returnLog, '房源不在定价推广中');
         return self::build_return(1, $returnLog);
     }
     //获取计划信息
     $planBll = new Bll_Fixedspread_AjkFixedSpread();
     $planInfo = $planBll->getStaticPlanById($params['plan_id']);
     if (empty($planInfo)) {
         array_push($returnLog, '计划信息为空');
         return self::build_return(1, $returnLog);
     }
     $planStatus = $planBll->getFixedPlanStatus($planInfo['Status'], $planInfo['ViewTime']);
     //1. 刪除 2.推广中 3.第二天推广 4.账户没钱停止 5.手动停止
     switch ($planStatus) {
         case 1:
             array_push($returnLog, '计划状态已被置为删除');
             break;
         case 2:
         case 3:
             //房源推广日志
             $data = self::build_prop_log($params, 4, json_encode(array("oldPrice" => $remark->oldPrice, "newPrice" => $remark->price, "msg" => "房源更新" . ";队列表id为" . $params['id'])), $params['broker_id']);
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 array_push($returnLog, "房源更新日志写入失败");
                 return self::build_return(0, $returnLog);
             }
             array_push($returnLog, "房源更新日志写入");
             //todo 竞价rebuild
             break;
         case 4:
             array_push($returnLog, "计划状态为账户没钱停止");
             break;
         case 5:
             array_push($returnLog, "计划状态为手动停止");
             break;
         default:
             break;
     }
     return self::build_return(1, $returnLog);
 }
Example #12
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 #13
0
 public static function change_prop_price($params)
 {
     $all_return = array("队列(" . $params['id'] . ")开始处理");
     $houseStatus = json_decode($params['remark'], 1);
     //根据查询结果判定房源是否在线
     if (Bll_City::isComboCity($params['city_id'])) {
         $houseRelationList = Bll_Combo_HouseRelation::getHouseRelation($params['broker_id'], $params['city_id'], array($params['pro_id']), Bll_Combo_HouseRelation::SITE_TYPE_JP);
         if (empty($houseRelationList)) {
             $all_return[] = '房源套餐关系为空';
             return self::build_return(1, $all_return);
         }
         foreach ($houseRelationList as $houseRelation) {
             if (Bll_Combo_HouseRelation::isRelationOnline($houseRelation['state'])) {
                 $data = self::build_prop_log($params, 4, '房源更新;队列表id为' . $params['id'], $params['broker_id']);
                 if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                     $all_return[] = '房源更新日志写入失败';
                 } else {
                     $all_return[] = '房源更新日志写入成功';
                 }
             }
         }
         //            return self::build_return(1, $all_return);
     }
     //PPC经纪人 房源是否在线
     $isHouseOnline = Bll_Plan_JpPlanManage::getInstance()->isHouseOnline($params['pro_id']);
     if ($isHouseOnline) {
         //写房源更新solr日志
         $data = self::build_prop_log($params, 4, "房源价格变更需要更新solr", $params['broker_id']);
         $houseStatus['newPrice'] = $houseStatus['price'];
         $houseStatus['msg'] = $data['remark'];
         $data['remark'] = json_encode($houseStatus);
         if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
             $all_return[] = "房源" . $params['pro_id'] . "更新solr成功";
             //价格变更需要重新rebuild房源的spreadPrice字段
             Bll_Plan_JpPlanManage::getInstance()->rebuildSpreadPrice($params['pro_id'], true);
         } else {
             $all_return[] = "房源" . $params['pro_id'] . "更新solr失败";
         }
     }
     //写房源修改价格日志
     $data = self::build_prop_log($params, 2, "房源修改价格", $params['broker_id']);
     $houseStatus['newPrice'] = $houseStatus['price'];
     $houseStatus['msg'] = $data['remark'];
     $data['remark'] = json_encode($houseStatus);
     if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         $all_return[] = '房源修改价格日志写入成功';
         return self::build_return(1, $all_return);
     } else {
         $all_return[] = '房源修改价格日志写入失败';
         return self::build_return(0, $all_return);
     }
 }
Example #14
0
 public function dealTask($task, $solrProIds)
 {
     $proId = $task['proid'];
     if (in_array($proId, $solrProIds)) {
         return true;
     }
     // 没有则通知solr上  且发邮件
     // 如果新端口 走中间件
     if (Bll_City::isComboCity($task['cityid'])) {
         Bll_Combo_NoticeSolrUpDown::noticeComboSolrHzAPI($task['city_id'], $task['userid'], $proId, 2);
     } else {
         Dao_Broker_HzProp::into_prop_lucene($proId, $task['cityid'], 1);
     }
     $this->errorPropIds[] = $proId;
     return true;
 }
 public function handle_request()
 {
     $cityIds = $this->getOption('city', array());
     if (empty($cityIds)) {
         $this->logMsg('Usage: launcher.php Combo_AjkCheckHouseIsValidate --cityId=... [--release=...] ');
         return;
     }
     $cityIdList = explode(',', $cityIds);
     $dealCityIdList = array();
     foreach ($cityIdList as $cityId) {
         if (false == Bll_City::isComboCity($cityId)) {
             $this->logMsg(sprintf('城市:%d 不是套餐城市,不予处理。', $cityId));
             continue;
         }
         $dealCityIdList[] = $cityId;
     }
     $this->logMsg(sprintf('开始处理城市[%s]........', implode(',', $dealCityIdList)));
     $brokerList = Bll_Broker::scanComboBrokerByCityId($dealCityIdList, $this->_startId, self::BROKER_LIMIT);
     if (empty($brokerList)) {
         $this->logMsg(sprintf('startId: %d 没有获取到经纪人。', $this->_startId));
         file_put_contents($this->_doneFile, 'YES');
         return;
     }
     foreach ($brokerList as $broker) {
         $this->setCursor($broker['brokerId']);
         $onlineHouseRelationList = Bll_Combo_HouseRelation::getOnlineHouseList($broker['brokerId'], $broker['cityId'], Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         /** 经纪人没有在线房源 */
         if (empty($onlineHouseRelationList)) {
             $this->logMsg(sprintf('经纪人[%d]没有在线房源', $broker['brokerId']));
             continue;
         }
         /** 获取在线房源ID */
         $onlineHouseList = array();
         foreach ($onlineHouseRelationList as $onlineHouseRelation) {
             $onlineHouseList[] = $onlineHouseRelation['houseId'];
         }
         $houseList = static::getInvalidateHouse($broker['cityId'], $broker['brokerId'], $onlineHouseList);
         /** 没有获取无效的房源信息 */
         if (empty($houseList)) {
             $this->logMsg(sprintf('经纪人[%d]没有获取无效的房源[%s]信息', $broker['brokerId'], implode(',', $onlineHouseList)));
             continue;
         }
         foreach ($houseList as $house) {
             $this->logMsg(sprintf('房源[%d] brokerId=%d operateState=%d isVisible=%d expireWorker=%s updatedDatetime=%s', $house['proId'], $house['brokerId'], $house['operateState'], $house['isVisible'], $house['expireWorker'], $house['updatedDatetime']));
             $effectRowCount = Bll_Combo_HouseRelation::updateHouseComboSpreadState($house['brokerId'], $house['proId'], Bll_Combo_HouseRelation::SITE_TYPE_AJK, Model_Combo_HouseRelation::ENUM_HOUSE_DELETE);
             if ($effectRowCount != 1) {
                 $this->logMsg(sprintf('房源[%d] 更新关系失败', $house['proId']));
                 continue;
             }
             /** 通知用户端下架房源 */
             $apiResponse = Bll_Combo_NoticeSolrUpDown::noticeComboSolrAjkAPI($broker['cityId'], $house['brokerId'], $house['proId'], Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN);
             if ($apiResponse['status'] == 'ok') {
                 $this->logMsg(sprintf('房源[%d] 通知下架成功', $house['proId']));
             } else {
                 $this->logMsg(sprintf('房源[%d] 通知下架失败, apiResponse:%s', $house['proId'], json_encode($apiResponse)));
             }
         }
     }
     if (count($brokerList) < self::BROKER_LIMIT) {
         $this->logMsg(sprintf('startId: %d 经纪人已经处理完成', $this->_startId));
         file_put_contents($this->_doneFile, 'YES');
     }
 }
Example #16
0
 public function afterPost()
 {
     // 推广
     if ($this->ctx['html_action'] == 'publish') {
         //伪登陆不能推广
         if ($this->ctx['isManagerCookie']) {
             $this->redirect2Result(Const_PublishCode::PSEUDO_ERROR, $this->site, $this->action, $this->ctx['proId']);
         }
         if (Bll_City::isComboCity($this->ctx['cityId'])) {
             // 套餐推广
             $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->ctx['ajkBrokerId'], $this->ctx['cityId'], $this->ctx['proId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         } else {
             // 双证审核未通过 不能推广
             // 获取经纪人信息
             $brokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($this->ctx['hzBrokerId']);
             // 身份是否通过
             $this->ctx['isPassVerify'] = $brokerInfo && Bll_Broker_HzBroker::isPassVerify($brokerInfo['profileVerify']);
             //if (!$isPassVerify)
             //    $this->redirect2Result(Const_PublishCode::NOT_PASS_VERIFY, $this->site, $this->action, $this->ctx['proId']);
             // 获取账户余额
             $balance = Bll_Broker_HzBroker::getAccountInfo($this->ctx['ajkBrokerId'], 'balance');
             $this->ctx['validMoney'] = $balance && $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
             //if (!$validMoney)
             //   $this->redirect2Result(Const_PublishCode::NOT_MONEY, $this->site, $this->action, $this->ctx['proId']);
             // ppc推广
             $spreadResult = Bll_Plan_Fix_HzFix::addPropToPlan($this->ctx['planId'], $this->ctx['proId'], $this->ctx['cityId'], $this->ctx['ajkBrokerId']);
         }
         // 推广出错
         if ($spreadResult['status'] <= 0) {
             $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, $this->site, $this->action, $this->ctx['proId'], $spreadResult['msg']);
         }
     }
     //++++++ others actions
     // 委托
     if (isset($this->ctx['isCommission']) && $this->ctx['isCommission']) {
         // 房源发布成功,回写委托信息
         if ($this->ctx['commission'] && $this->ctx['proId']) {
             Bll_House_HzHouse::updateCommission($this->ctx['commissionId'], $this->ctx['proId']);
         }
     }
 }
Example #17
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));
 }