コード例 #1
0
ファイル: HzProp.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param $cityId
  * @param $propId
  * @param $planType 1.定价,2.竞价,3.定+竟
  * @param $status
  * @return array
  */
 public static function updatePropStatus($cityId, $propId, $planType, $status)
 {
     $propPlanType = self::getPropPlanType($propId);
     /** 记录房源下线日志 */
     if ($status != 1) {
         //TODO
     }
     $needMap2PropStatus = false;
     $propUpdatedStatus = $status;
     switch ($planType) {
         case 1:
             if (isset($propPlanType['bid']['isValid']) && !empty($propPlanType['bid']['isValid'])) {
                 $propUpdatedStatus = $propPlanType['bid']['isValid'];
                 $needMap2PropStatus = true;
             }
             break;
         case 2:
             if ($status == 1) {
                 $propUpdatedStatus = 1;
             } else {
                 if (isset($propPlanType['fix']['isValid']) && !empty($propPlanType['fix']['isValid'])) {
                     $propUpdatedStatus = $propPlanType['fix']['isValid'];
                     $needMap2PropStatus = true;
                 } else {
                     $propUpdatedStatus = $status;
                 }
             }
             break;
         case 3:
             $propUpdatedStatus = $status;
             break;
     }
     if ($needMap2PropStatus) {
         $propUpdatedStatus = self::mapPropStatus($propUpdatedStatus);
     }
     /** 更新 prop 表 */
     $prop = Model_House_HzProp::get_prop_info_by_prop_id($propId);
     $prop['contentBasic']['status'] = $propUpdatedStatus;
     Model_House_HzProp::updateProp($propId, array('contentBasic' => json_encode($prop['contentBasic'])));
     Model_House_HzPropSearch::updatePropStatus($cityId, $propId, $propUpdatedStatus);
     return $propPlanType;
 }
コード例 #2
0
 public function handle_request()
 {
     $condition = array(array('proid', '>', $this->_startId), array('cityid', '=', $this->_cityId), array('created', '<', $this->_expireTime), array('status', '<>', Const_HzStatus::EXPIRED), array('status', '<>', Const_HzStatus::REMOVE));
     $houseList = Model_House_HzPropSearch::getPropLists($this->_cityId, $condition, self::BATCH_LIMIT);
     if (empty($houseList)) {
         $this->setShStopFlag();
         $this->setLog('处理完成');
         return;
     }
     foreach ($houseList as $house) {
         $houseId = $house['proid'];
         $this->setLog(sprintf('开始处理房源[%d], 房源发布时间[%s]: %s', $houseId, date('Y-m-d H:i:s', $house['created']), json_encode($house)));
         $this->setFlag(array('id' => $houseId), $this->_cursorFile);
         if (1 != Model_House_HzPropSearch::updatePropStatus($this->_cityId, $houseId, Const_HzStatus::EXPIRED)) {
             $this->setLog(sprintf('房源[%d]更新房源状态失败', $houseId));
             continue;
         }
         $comboHouseRelation = Bll_Combo_HouseRelation::getRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, false);
         if (empty($comboHouseRelation)) {
             $this->setLog(sprintf('房源[%d]没有获取到套餐推广关系', $houseId));
             continue;
         }
         $this->setLog(sprintf('房源[%d]套餐推广关系: %s', $houseId, json_encode($comboHouseRelation)));
         if (!Bll_Combo_HouseRelation::isRelationOnline($comboHouseRelation['state'])) {
             $this->setLog(sprintf('房源[%d]套餐推广状态不在线[%d]', $houseId, $comboHouseRelation['state']));
             continue;
         }
         $this->setLog(sprintf('房源[%d]套餐推广状态在线[%d]', $houseId, $comboHouseRelation['state']));
         if (1 != Bll_Combo_HouseRelation::updateComboStatusById($comboHouseRelation['id'], Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE, Bll_Combo_HouseRelation::SITE_TYPE_HZ)) {
             $this->setLog(sprintf('更新房源[%d]套餐关系[%d : %d -> %d]失败', $houseId, $comboHouseRelation['id'], $comboHouseRelation['state'], Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE));
             continue;
         }
         $this->setLog(sprintf('更新房源[%d]套餐关系[%d : %d -> %d]成功', $houseId, $comboHouseRelation['id'], $comboHouseRelation['state'], Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE));
         $this->noticeComboSolr($this->_cityId, $house['userid'], $houseId, $comboHouseRelation['brokerId']);
     }
     if (count($houseList) < self::BATCH_LIMIT) {
         $this->setShStopFlag();
     }
 }
コード例 #3
0
ファイル: HzBid.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 竞价计划状态,更新房源状态
  *
  * @param $cityId
  * @param $propId
  */
 public static function bidStatusChangeUpdatePropStatus($cityId, $propId)
 {
     $propSearchInfo = Model_House_HzPropSearch::get_prop_by_prop_id($cityId, $propId);
     if (empty($propSearchInfo)) {
         return;
     }
     $oldStatus = $propSearchInfo['status'];
     $fixPropPlan = Model_Plan_HzPlanning::getPropFixPlan($propId);
     $newStatus = Bll_Ppc_HzProp::mapPropStatus($fixPropPlan['is_valid']);
     Model_House_HzPropSearch::updatePropStatus($cityId, $propId, $newStatus);
     Bll_HzProp::updatePropStatus($propId, $newStatus);
 }