作者 李宇航

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

GXgeo设置脚本



查看合并请求 !2332
... ... @@ -100,7 +100,7 @@ class GeoQuestionRes extends Command
}
// 命中文案
$hit_data[] = $result['text'];
if(FALSE == empty($result['annotations'])){
if(!empty($result['annotations'])){
$url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
$title = array_column(array_column($result['annotations'], 'url_citation'), 'title');;
$hit_data = array_merge($url, $title, $hit_data);
... ... @@ -109,14 +109,14 @@ class GeoQuestionRes extends Command
// 命中关键词和路由
$hit_keyword = $hit_url = [];
$hit = 0;
if ($taskInfo['keywords']) {
if (!empty($taskInfo['keywords'])) {
$pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['keywords'])) . ')/i';
if (preg_match($pattern, $hit_string, $matches)) {
$hit_keyword = $matches[0];
$hit++;
}
}
if ($taskInfo['url']) {
if (!empty($taskInfo['url'])) {
$pattern = '/(' . implode('|', array_map('preg_quote', $taskInfo['url'])) . ')/i';
if (preg_match($pattern, $hit_string, $matches)) {
$hit_url = $matches[0];
... ... @@ -128,7 +128,7 @@ class GeoQuestionRes extends Command
$save_data = [
'project_id' => $taskInfo['project_id'],
'question_id' => $task_id,
'type' => $task->type ?? GeoQuestion::TYPE_BRAND,
'type' => $taskInfo['type'] ?? $geoQuestionModel::TYPE_BRAND,
'platform' => $platform,
'question' => $question,
'keywords' => json_encode($hit_keyword,true),//命中的关键词
... ...