Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
1 个修改的文件
包含
11 行增加
和
7 行删除
| @@ -310,15 +310,19 @@ class SyncSubmitTaskService | @@ -310,15 +310,19 @@ class SyncSubmitTaskService | ||
| 310 | //过滤内容 | 310 | //过滤内容 |
| 311 | if(!empty($data['data']['message'])) { | 311 | if(!empty($data['data']['message'])) { |
| 312 | //过滤内容关键字 | 312 | //过滤内容关键字 |
| 313 | - if (!empty($config['filter_contents'])){ | 313 | + if (!empty($config['filter_contents'])) { |
| 314 | foreach ($config['filter_contents'] as $filter_content) { | 314 | foreach ($config['filter_contents'] as $filter_content) { |
| 315 | - //要指定词才过滤 | ||
| 316 | - if (preg_match("/\b" . preg_quote($filter_content, "/") . "\b/i", $data['data']['message'])) { | ||
| 317 | - throw new InquiryFilterException('过滤内容:' . $filter_content); | 315 | + //中文直接包含 |
| 316 | + if (preg_match("/^[\x{4e00}-\x{9fa5}]+$/u", $filter_content)) { | ||
| 317 | + if (Str::contains($data['data']['message'], $filter_content)) { | ||
| 318 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + //英文要指定词才过滤 | ||
| 322 | + if (preg_match("/\b" . preg_quote($filter_content, "/") . "\b/i", $data['data']['message'])) { | ||
| 323 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 324 | + } | ||
| 318 | } | 325 | } |
| 319 | -// if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) { | ||
| 320 | -// throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 321 | -// } | ||
| 322 | } | 326 | } |
| 323 | } | 327 | } |
| 324 | 328 |
-
请 注册 或 登录 后发表评论