|
...
|
...
|
@@ -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];
|
...
|
...
|
|