作者 李宇航

合并分支 'lyh-server' 到 'master'

GXgeo设置



查看合并请求 !2330
@@ -207,12 +207,13 @@ class GeoQuestionRes extends Command @@ -207,12 +207,13 @@ class GeoQuestionRes extends Command
207 public function getTaskId(){ 207 public function getTaskId(){
208 $key = 'geo_task_list'; 208 $key = 'geo_task_list';
209 $task_id = Redis::rpop($key); 209 $task_id = Redis::rpop($key);
210 - if (empty($task_id)) {  
211 - $ids = GeoQuestion::where(['status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->get('id');  
212 - if ($ids->isEmpty())  
213 - return $task_id;  
214 - foreach ($ids as $item) {  
215 - Redis::lpush($key, $item->id); 210 + if(empty($task_id)){
  211 + $questionModel = new GeoQuestion();
  212 + $ids = $questionModel->selectField(['status'=>1,'next_time'=>['<=',date('Y-m-d')]],'id');
  213 + if(!empty($ids)){
  214 + foreach ($ids as $id) {
  215 + Redis::lpush($key, $id);
  216 + }
216 } 217 }
217 $task_id = Redis::rpop($key); 218 $task_id = Redis::rpop($key);
218 } 219 }