作者 李宇航

合并分支 'lyh-server' 到 'master'

GXgeo设置脚本



查看合并请求 !2332
@@ -100,7 +100,7 @@ class GeoQuestionRes extends Command @@ -100,7 +100,7 @@ class GeoQuestionRes extends Command
100 } 100 }
101 // 命中文案 101 // 命中文案
102 $hit_data[] = $result['text']; 102 $hit_data[] = $result['text'];
103 - if(FALSE == empty($result['annotations'])){ 103 + if(!empty($result['annotations'])){
104 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url'); 104 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
105 $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');; 105 $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');;
106 $hit_data = array_merge($url, $title, $hit_data); 106 $hit_data = array_merge($url, $title, $hit_data);
@@ -109,14 +109,14 @@ class GeoQuestionRes extends Command @@ -109,14 +109,14 @@ class GeoQuestionRes extends Command
109 // 命中关键词和路由 109 // 命中关键词和路由
110 $hit_keyword = $hit_url = []; 110 $hit_keyword = $hit_url = [];
111 $hit = 0; 111 $hit = 0;
112 - if ($taskInfo['keywords']) { 112 + if (!empty($taskInfo['keywords'])) {
113 $pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['keywords'])) . ')/i'; 113 $pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['keywords'])) . ')/i';
114 if (preg_match($pattern, $hit_string, $matches)) { 114 if (preg_match($pattern, $hit_string, $matches)) {
115 $hit_keyword = $matches[0]; 115 $hit_keyword = $matches[0];
116 $hit++; 116 $hit++;
117 } 117 }
118 } 118 }
119 - if ($taskInfo['url']) { 119 + if (!empty($taskInfo['url'])) {
120 $pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['url'])) . ')/i'; 120 $pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['url'])) . ')/i';
121 if (preg_match($pattern, $hit_string, $matches)) { 121 if (preg_match($pattern, $hit_string, $matches)) {
122 $hit_url = $matches[0]; 122 $hit_url = $matches[0];
@@ -128,7 +128,7 @@ class GeoQuestionRes extends Command @@ -128,7 +128,7 @@ class GeoQuestionRes extends Command
128 $save_data = [ 128 $save_data = [
129 'project_id' => $taskInfo['project_id'], 129 'project_id' => $taskInfo['project_id'],
130 'question_id' => $task_id, 130 'question_id' => $task_id,
131 - 'type' => $task->type ?? GeoQuestion::TYPE_BRAND, 131 + 'type' => $taskInfo['type'] ?? $geoQuestionModel::TYPE_BRAND,
132 'platform' => $platform, 132 'platform' => $platform,
133 'question' => $question, 133 'question' => $question,
134 'keywords' => json_encode($hit_keyword,true),//命中的关键词 134 'keywords' => json_encode($hit_keyword,true),//命中的关键词