|
...
|
...
|
@@ -43,6 +43,12 @@ class GeoQuestionRes extends Command |
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$project_id = GeoQuestion::where(['status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d', strtotime('+2 day')))->value('project_id');
|
|
|
|
$ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('current_time', '<>', date('Y-m-d', strtotime('-1 day')))->pluck('id');
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
dd($id);
|
|
|
|
}
|
|
|
|
dd(1);
|
|
|
|
while (true) {
|
|
|
|
$task_id = $this->getTaskId();
|
|
|
|
if (empty($task_id)) {
|
|
...
|
...
|
@@ -337,13 +343,14 @@ class GeoQuestionRes extends Command |
|
|
|
$key = 'geo_task_list';
|
|
|
|
$task_id = Redis::rpop($key);
|
|
|
|
if(empty($task_id)){
|
|
|
|
$questionModel = new GeoQuestion();
|
|
|
|
$ids = $questionModel->selectField(['status'=>$questionModel::STATUS_OPEN,'next_time'=>['<=',date('Y-m-d')]],'id');
|
|
|
|
if(!empty($ids)){
|
|
|
|
# TODO 按照项目进行获取, 一个项目当天需要将所有跑完
|
|
|
|
$project_id = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))->value('project_id');
|
|
|
|
if (empty($project_id))
|
|
|
|
return $task_id;
|
|
|
|
$ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('current_time', '<>', date('Y-m-d'))->pluck('id');
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
Redis::lpush($key, $id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$task_id = Redis::rpop($key);
|
|
|
|
}
|
|
|
|
return $task_id;
|
...
|
...
|
|