正在显示
1 个修改的文件
包含
9 行增加
和
2 行删除
| @@ -383,9 +383,16 @@ class UpdateSeoTdk extends Command | @@ -383,9 +383,16 @@ class UpdateSeoTdk extends Command | ||
| 383 | 383 | ||
| 384 | $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $title); | 384 | $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $title); |
| 385 | //in,for,with,to,near,from 这些介词 只拼前缀,不拼后缀 | 385 | //in,for,with,to,near,from 这些介词 只拼前缀,不拼后缀 |
| 386 | - $suffix_ban = ['in ', 'for ', 'with ', 'to ', 'near ','from ', 'In ', 'For ', 'With ', 'To ', 'Near ','From ']; | 386 | + $is_contains_jieci = false; |
| 387 | + $words = explode(' ', $title); | ||
| 388 | + foreach ($words as $word){ | ||
| 389 | + $word = Str::replace([',', '!', '?'], '', $word); | ||
| 390 | + if(in_array(strtolower($word), ['in', 'for', 'with', 'to', 'near','from'])){ | ||
| 391 | + $is_contains_jieci = true; | ||
| 392 | + } | ||
| 393 | + } | ||
| 387 | $suffix = ''; | 394 | $suffix = ''; |
| 388 | - if(!Str::contains($title, $suffix_ban)){ | 395 | + if(!$is_contains_jieci){ |
| 389 | // 某些后缀不能并存的情况 | 396 | // 某些后缀不能并存的情况 |
| 390 | $ban_suffix = []; | 397 | $ban_suffix = []; |
| 391 | //services/service 结尾的词,后缀不拼manufacturer,factory | 398 | //services/service 结尾的词,后缀不拼manufacturer,factory |
-
请 注册 或 登录 后发表评论