作者 lyh

gx

... ... @@ -49,8 +49,9 @@ class GoogleSearchKeyword extends Command
* @time :2025/3/31 11:37
*/
public function handle(){
$noticeModel = new NoticeLog();
while (true){
$list = NoticeLog::where('type', NoticeLog::GOOGLE_SEARCH)->where('status', NoticeLog::STATUS_PENDING)->get();
$list = $noticeModel->list(['type'=>NoticeLog::GOOGLE_SEARCH,'status'=>NoticeLog::STATUS_PENDING]);;
if(empty($list)){
sleep(50);
return true;
... ... @@ -58,7 +59,12 @@ class GoogleSearchKeyword extends Command
foreach ($list as $val){
$data = json_decode($val['data'],true);
echo '执行的任务id:'.$val['id'].',项目id:'.$data['project_id']??''.PHP_EOL;
$this->_action($data['domain'],$data['type'],$data['project_id']);
$result = $this->_action($data['domain'],$data['type'],$data['project_id']);
$status = NoticeLog::STATUS_SUCCESS;
if($result === false){
$status = NoticeLog::STATUS_FAIL;
}
$noticeModel->edit(['status'=>$status],['id'=>$val['id']]);
echo '任务结束'.PHP_EOL;
}
}
... ... @@ -77,7 +83,7 @@ class GoogleSearchKeyword extends Command
$data = $googleService->googleSearch($domain,$type);
if(empty($data)){
echo '域名:'.$domain.'拉取数据为空.'.PHP_EOL;
return true;
return false;
}
//保存一条主记录诗句
$searchModel = new GoogleSearch();
... ...