作者 lyh

GXgeo设置

... ... @@ -207,12 +207,13 @@ class GeoQuestionRes extends Command
public function getTaskId(){
$key = 'geo_task_list';
$task_id = Redis::rpop($key);
if (empty($task_id)) {
$ids = GeoQuestion::where(['status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->get('id');
if ($ids->isEmpty())
return $task_id;
foreach ($ids as $item) {
Redis::lpush($key, $item->id);
if(empty($task_id)){
$questionModel = new GeoQuestion();
$ids = $questionModel->selectField(['status'=>1,'next_time'=>['<=',date('Y-m-d')]],'id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush($key, $id);
}
}
$task_id = Redis::rpop($key);
}
... ...