/**
  * 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));
 }
 /**
  * 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->writeLog('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'];
     // 取游标
     $beginId = @(int) file_get_contents($this->idFile);
     // 标记处理状态
     Bll_Cms_BlockChange::updateDoList($actionId, 5, 1, 'action:' . $actionId . ' list_id:5 处理中..房子:' . $beginId);
     //更新租房房源信息并重新定竞价
     $result = Bll_HzProp::dealPropCommidZero($beginId, $nocomms, $cityId, $this->idFile);
     // 如果返回空 重置游标
     if (!$result['status'] && $result['msg'] == 'empty') {
         $result['msg'] = array();
         $result['msg'][] = "action: " . $actionId . ",is finished";
         file_put_contents($this->idFile, 'END');
         foreach ($nocomms as $nocomm) {
             // 更新状态
             Bll_Cms_BlockChange::updateNocomm($nocomm['id'], 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->writeLog($msg);
         }
     }
 }
 public function handle_request()
 {
     $this->setLog(sprintf('[%s] start actionId: %s', date('Y-m-d H:i:s'), $this->actionId));
     // 获取任务
     $tasks = $this->getTasks();
     if ($tasks === false) {
         $this->setLog(sprintf('[%s] remark: %s', date('Y-m-d H:i:s'), '获取数据失败'));
         exit;
     }
     if (empty($tasks)) {
         //没有数据
         // 更新action完成
         Bll_Cms_BlockChange::updateAction($this->actionId, 1);
         // 任务完成
         $this->setLog(sprintf('[%s] remark: %s', date('Y-m-d H:i:s'), '任务执行完成'));
         exit;
     }
     // 循环处理任务
     foreach ($tasks as $task) {
         $this->dealTask($task);
     }
     $this->setLog(sprintf('[%s] end actionId: %s', date('Y-m-d H:i:s'), $this->actionId));
 }