作者 周海龙

合并分支 'zhl' 到 'master'

Zhl



查看合并请求 !2926
@@ -337,12 +337,13 @@ class GeoQuestionRes extends Command @@ -337,12 +337,13 @@ class GeoQuestionRes extends Command
337 $key = 'geo_task_list'; 337 $key = 'geo_task_list';
338 $task_id = Redis::rpop($key); 338 $task_id = Redis::rpop($key);
339 if(empty($task_id)){ 339 if(empty($task_id)){
340 - $questionModel = new GeoQuestion();  
341 - $ids = $questionModel->selectField(['status'=>$questionModel::STATUS_OPEN,'next_time'=>['<=',date('Y-m-d')]],'id');  
342 - if(!empty($ids)){  
343 - foreach ($ids as $id) {  
344 - Redis::lpush($key, $id);  
345 - } 340 + # TODO 按照项目进行获取, 一个项目当天需要将所有跑完
  341 + $project_id = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))->value('project_id');
  342 + if (empty($project_id))
  343 + return $task_id;
  344 + $ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('current_time', '<>', date('Y-m-d'))->pluck('id');
  345 + foreach ($ids as $id) {
  346 + Redis::lpush($key, $id);
346 } 347 }
347 $task_id = Redis::rpop($key); 348 $task_id = Redis::rpop($key);
348 } 349 }