作者 lyh

GX生成白帽报表脚本

@@ -77,6 +77,8 @@ class GeoQuestionRes extends Command @@ -77,6 +77,8 @@ class GeoQuestionRes extends Command
77 echo $e->getMessage().PHP_EOL; 77 echo $e->getMessage().PHP_EOL;
78 continue; 78 continue;
79 } 79 }
  80 + //查询当前是否已有执行保存记录
  81 + $resultInfo = $geoResultModel->read(['project_id'=>$info['project_id'],'question_id'=>$info['id'],'platform'=>$p_item,'question'=>$q_item],['id']);
80 //保存一条结果记录 82 //保存一条结果记录
81 $data = [ 83 $data = [
82 'project_id'=>$info['project_id'], 84 'project_id'=>$info['project_id'],
@@ -87,7 +89,11 @@ class GeoQuestionRes extends Command @@ -87,7 +89,11 @@ class GeoQuestionRes extends Command
87 'text'=>json_encode($result_data ?? [],true), 89 'text'=>json_encode($result_data ?? [],true),
88 'url'=>json_encode($urls ?? [],true),//命中的网址 90 'url'=>json_encode($urls ?? [],true),//命中的网址
89 ]; 91 ];
90 - $geoResultModel->addReturnId($data); 92 + if($resultInfo === false){
  93 + $geoResultModel->addReturnId($data);
  94 + }else{
  95 + $geoResultModel->edit($data,['id'=>$resultInfo['id']]);
  96 + }
91 } 97 }
92 } 98 }
93 //更新下次执行时间 99 //更新下次执行时间