正在显示
1 个修改的文件
包含
3 行增加
和
3 行删除
| @@ -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]; |
-
请 注册 或 登录 后发表评论