/**
  * Job执行逻辑
  */
 public function handle_request()
 {
     // check
     if (!($this->checkParams() && $this->isActionNotDone() && $this->isPreFinished())) {
         return false;
     }
     $actionId = $this->actionId;
     // 获取该actionid的Nocomms
     $nocomms = Bll_Cms_BlockChange::getNocommsByAction(Bll_Cms_BlockChange::getActionWithCommunity($this->actionId));
     if (empty($nocomms)) {
         $this->setLog('nocomms is empty');
         Bll_Cms_BlockChange::updateDoList($actionId, 5, 2);
         // 更新action完成
         Bll_Cms_BlockChange::updateAction($actionId, 1);
         return false;
     }
     $commsValus = array_values($nocomms);
     $cityId = $commsValus[0]['city_id'];
     // 取游标
     $flag = $this->getFlag();
     if (isset($flag['id']) && is_numeric($flag['id'])) {
         $this->cursor = $flag['id'];
     } else {
         $this->cursor = 0;
     }
     // 标记处理状态
     Bll_Cms_BlockChange::updateDoList($actionId, 5, 1, 'action:' . $actionId . ' list_id:5 处理中..房子:' . $this->cursor);
     //更新租房房源信息
     $result = $this->dealPropCommidZero($this->cursor, $nocomms, $cityId);
     // 如果返回空 重置游标
     if (!$result['status'] && $result['msg'] == 'empty') {
         //游标置为0
         $this->cursor = 0;
         foreach ($nocomms as $nocomm) {
             // 更新状态
             Dao_Cms_BlockChange::updateNocommByCode($nocomm['old_code'], $nocomm['new_code'], 1);
         }
         // 更新dolist
         Bll_Cms_BlockChange::updateDoList($actionId, 5, 2);
         // 更新action完成
         Bll_Cms_BlockChange::updateAction($actionId, 1);
     }
     // 记录log
     if ($result['msg'] && is_array($result['msg'])) {
         foreach ($result['msg'] as $msg) {
             $this->setLog($msg);
         }
     }
     //记录游标
     $this->setFlag(array('id' => $this->cursor));
 }
Пример #2
0
 /**
  * 更新nocomm状态
  * @param $id
  * @param $status
  */
 public static function updateNocomm($id, $status)
 {
     return Dao_Cms_BlockChange::updateNocomm($id, $status);
 }