作者 lyh

变更数据

@@ -339,7 +339,12 @@ class GeoQuestionRes extends Command @@ -339,7 +339,12 @@ class GeoQuestionRes extends Command
339 $key = 'geo_task_list'; 339 $key = 'geo_task_list';
340 $task_id = Redis::rpop($key); 340 $task_id = Redis::rpop($key);
341 if(empty($task_id)){ 341 if(empty($task_id)){
342 - $project_ids = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))->orderBy('next_time', 'asc')->groupBy('project_id')->pluck('project_id'); 342 + $project_ids = GeoQuestion::select('project_id', DB::raw('MIN(next_time) as min_time'))
  343 + ->where('status', GeoQuestion::STATUS_OPEN)
  344 + ->where('next_time', '<=', date('Y-m-d'))
  345 + ->groupBy('project_id')
  346 + ->orderBy('min_time', 'asc')
  347 + ->pluck('project_id');
343 if(!empty($project_ids)){ 348 if(!empty($project_ids)){
344 foreach ($project_ids as $project_id){ 349 foreach ($project_ids as $project_id){
345 $ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->pluck('id'); 350 $ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->pluck('id');