private function fetchTasks() { $tasks = Model_Log_HouseLogNew::data_access(Util_DbSplitSuffix::yearMonthDay($this->cursor->date))->filter_by_op('id', '>', $this->cursor->id)->limit($this->per)->find(); if (empty($tasks) && strtotime($this->cursor->date) < strtotime(date('Y-m-d 00:00:00'))) { $this->cursor->date = date('Y-m-d', strtotime('+1 day', strtotime($this->cursor->date))); $this->cursor->id = 0; $this->cursor->save(); } return $tasks; }
/** * 内部实际处理函数 * * @throws Exception */ public function run() { //根据游标获取日志文件 $records = Model_Log_HouseLogNew::data_access($this->date)->filter_by_op('id', '>', $this->cursor)->limit($this->limit)->find(); //无处理数据推出 if (empty($records)) { $this->noLogQuit('no data need fix'); } $this->addLogger('获取房源日志数据为' . json_encode($records)); //solr处理 $this->addLogger('solr处理开始'); $this->noticeSolr($records); $this->addLogger('solr处理结束'); //房源推广变更日志 $this->addLogger('房源推广变更日志处理开始'); $this->proSpreadChangeLogCreate($records); $this->addLogger('房源推广变更日志处理结束'); //房源第一次推广日志 $this->addLogger('房源第一次推广日志处理开始'); $this->proFirstSpreadLogCreate($records); $this->addLogger('房源第一次推广日志处理结束'); //房源操作日志 $this->addLogger('房源操作日志处理开始'); $this->proActionLogCreate($records); $this->addLogger('房源操作日志处理结束'); //设置游标 $this->setFlag(array('cursor' => $this->cursor + $this->limit)); $this->addLogger('当次PHP执行完成'); }