作者 lyh

GX生成白帽报表脚本

... ... @@ -9,7 +9,9 @@
namespace App\Console\Commands\Geo;
use App\Models\Geo\GeoPlatform;
use App\Models\Geo\GeoQuestion;
use App\Services\Geo\GeoService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
... ... @@ -30,8 +32,30 @@ class GeoQuestionResult extends Command
protected $description = 'geo设置请求获取结果';
public function handle(){
$task_id = $this->getTaskId();
dd($task_id);
while (true){
$task_id = $this->getTaskId();
$questionModel = new GeoQuestion();//问题
$info = $questionModel->read(['id'=>$task_id]);
$questionArr = $info['question'];
if(empty($questionArr)){
echo date('Y-m-d H:i:s').'当前任务不存在问题。'.PHP_EOL;
$questionModel->edit(['status'=>2],['id'=>$task_id]);
}
//获取平台信息
$platformModel = new GeoPlatform();//平台
$platformArr = $platformModel->selectField(['status'=>$platformModel::STATUS_ON],'en_name');
if(empty($platformArr)){
echo date('Y-m-d H:i:s').'请求平台为空。'.PHP_EOL;
continue;
}
$geoService = new GeoService();
foreach ($questionArr as $q_item){
foreach ($platformArr as $p_item){
dd($q_item,$p_item);
$geoService->setWebSearchChatAction($q_item,$p_item);
}
}
}
}
/**
... ...
... ... @@ -35,7 +35,7 @@ class GeoPlatform extends Base
public function getList(){
$data = Cache::get('geo_platform');
if(empty($data)){
$data = $this->list(['status'=>$this::STATUS_ON],'id',['name','icon','sort'],'desc');
$data = $this->list(['status'=>$this::STATUS_ON],'id',['name','en_name','icon','sort'],'desc');
Cache::put('geo_platform',$data,'12 * 3600');
}
return $data;
... ...
... ... @@ -21,7 +21,7 @@ class GeoService
* @method :post
* @time :2025/7/3 14:26
*/
public function webSearchChatAction($content,$platform){
public function setWebSearchChatAction($content,$platform){
$route = 'v1/websearch_chat';
$url = $this->api_url.$route;
$header = [
... ...