作者 lyh

geo脚本设置

@@ -76,7 +76,7 @@ class GeoQuestionRes extends Command @@ -76,7 +76,7 @@ class GeoQuestionRes extends Command
76 $geoLogModel = new GeoQuestionLog(); 76 $geoLogModel = new GeoQuestionLog();
77 foreach ($taskInfo['question'] as $question) { 77 foreach ($taskInfo['question'] as $question) {
78 foreach ($platformsArr as $platform) { 78 foreach ($platformsArr as $platform) {
79 - $data = $hit_data = $result = []; 79 + $data = $hit_data = [];
80 $error_num = 0; 80 $error_num = 0;
81 // 设置重试, 有的平台不一定能正常获取到数据 81 // 设置重试, 有的平台不一定能正常获取到数据
82 GET_RESULT: 82 GET_RESULT:
@@ -123,6 +123,7 @@ class GeoQuestionRes extends Command @@ -123,6 +123,7 @@ class GeoQuestionRes extends Command
123 $hit++; 123 $hit++;
124 } 124 }
125 } 125 }
  126 + echo 'MZ-url'.json_encode($hit_url).PHP_EOL;
126 // 保存数据结果 127 // 保存数据结果
127 $geo_result = $geoResultModel->read(['project_id' => $taskInfo['project_id'], 'question_id' => $task_id, 'platform' => $platform, 'question' => $question],['id']); 128 $geo_result = $geoResultModel->read(['project_id' => $taskInfo['project_id'], 'question_id' => $task_id, 'platform' => $platform, 'question' => $question],['id']);
128 $save_data = [ 129 $save_data = [
@@ -134,10 +135,14 @@ class GeoQuestionRes extends Command @@ -134,10 +135,14 @@ class GeoQuestionRes extends Command
134 'keywords' => json_encode($hit_keyword,true),//命中的关键词 135 'keywords' => json_encode($hit_keyword,true),//命中的关键词
135 'url' => json_encode($hit_url,true),//命中的网址 136 'url' => json_encode($hit_url,true),//命中的网址
136 'text' => json_encode($result,true), 137 'text' => json_encode($result,true),
137 - 'hit' => $hit 138 + 'hit' => $hit,
  139 + 'created_at'=>date('Y-m-d H:i:s'),
  140 + 'updated_at'=>date('Y-m-d H:i:s'),
138 ]; 141 ];
  142 +// echo '当前数据INFO:'.json_encode($save_data,true).PHP_EOL;
139 if($geo_result === false){ 143 if($geo_result === false){
140 - $geoResultModel->addReturnId($save_data); 144 + $id= $geoResultModel->insertGetId($save_data);
  145 + echo '当前数据id:'.$id.PHP_EOL;
141 }else{ 146 }else{
142 $geoResultModel->edit($save_data, ['id' => $geo_result['id']]); 147 $geoResultModel->edit($save_data, ['id' => $geo_result['id']]);
143 } 148 }