public function handle_request() { $houseRelationList = $this->getComboSpreadHouseList(); foreach ($houseRelationList as $houseRelation) { $this->setCursor($houseRelation['id']); $this->logMsg(sprintf('处理房源[%d] %s', $houseRelation['houseId'], json_encode($houseRelation))); $houseRank = Model_Jinpu_HouseRank::getHouseRankById($houseRelation['houseId']); if (empty($houseRank)) { $this->logMsg(sprintf('房源[%d]没有获取到rank信息', $houseRelation['houseId'])); continue; } $rankUpdateTime = strtotime($houseRank['update_time']); $spreadTime = strtotime($houseRelation['updateTime']); /** 如果rank的更新时间 大于 房源做推广的时间,就通知solr更新房源信息 */ if ($rankUpdateTime >= $spreadTime) { $houseInfo = $this->getHouseInfo($houseRelation['houseId']); if (empty($houseInfo)) { $this->logMsg('获取房源[%d]信息失败', $houseRelation['houseId']); continue; } $this->logMsg(sprintf('房源信息 %s', json_encode($houseInfo))); if ($houseInfo['houseType'] < 1 || $houseInfo['houseType'] > 4) { $this->logMsg(sprintf('房源[%d]信息错误', $houseRelation['houseId'])); continue; } $requestId = date('Ymd', $rankUpdateTime) . $houseRelation['id']; $from = Bll_Combo_NoticeSolrUpDown::HLS_FROM_REPAIR_UPDATE_RANK_NOTIFY_SOLR; // $action = Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_UP; // $result = Bll_Combo_NoticeSolrUpDown::noticeComboSolrJpAPI($houseRelation['cityId'], $houseRelation['brokerId'], $houseRelation['houseId'], $houseInfo['houseType'], $action, $from, $rankUpdateTime, $requestId); $result = Bll_Combo_NoticeSolrUpDown::noticeUpdateJpAPI($houseRelation['cityId'], $houseRelation['houseId'], $houseInfo['houseType'], $from, $rankUpdateTime, $requestId); if (is_array($result) && $result['status'] == 'ok') { $this->logMsg(sprintf('房源[%d]通知solr成功 %s', $houseRelation['houseId'], json_encode($result))); continue; } $this->logMsg(sprintf('房源[%d]通知solr失败 %s', $houseRelation['houseId'], json_encode($result))); } } if (count($houseRelationList) < self::BATCH_LIMIT) { file_put_contents($this->_doneFile, 'DONE'); } }