|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :GeoQuestionResult.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 15:13
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Geo;
|
|
|
|
|
|
|
|
use App\Models\Geo\GeoQuestion;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
|
|
class GeoQuestionResult extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'geo_question_result';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'geo设置请求获取结果';
|
|
|
|
|
|
|
|
public function handle(){
|
|
|
|
$task_id = $this->getTaskId();
|
|
|
|
dd($task_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :拉取任务id
|
|
|
|
* @name :getTaskId
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 15:15
|
|
|
|
*/
|
|
|
|
public function getTaskId(){
|
|
|
|
$task_id = Redis::rpop('geo_question_result');
|
|
|
|
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('geo_question_result', $id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$task_id = Redis::rpop('ai_blog_task');
|
|
|
|
}
|
|
|
|
return $task_id;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|