作者 赵彬吉

update

@@ -374,7 +374,7 @@ class UpdateSeoTdk extends Command @@ -374,7 +374,7 @@ class UpdateSeoTdk extends Command
374 $seo_title = $v[$this->topic_fields[$table]];; 374 $seo_title = $v[$this->topic_fields[$table]];;
375 //只有推广项目 才加 前后缀 375 //只有推广项目 才加 前后缀
376 if($project->type == Project::TYPE_TWO) { 376 if($project->type == Project::TYPE_TWO) {
377 - $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $seo_title); 377 + $prefix = $this->getPrefixKeyword($project_id, 'prefix', 2, $seo_title);
378 $suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, trim($prefix . ' ' . $seo_title)); 378 $suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, trim($prefix . ' ' . $seo_title));
379 if(Str::startsWith($suffix, ', ')){ 379 if(Str::startsWith($suffix, ', ')){
380 $seo_title = $prefix . ' ' . $seo_title . $suffix; 380 $seo_title = $prefix . ' ' . $seo_title . $suffix;
@@ -574,7 +574,7 @@ class UpdateSeoTdk extends Command @@ -574,7 +574,7 @@ class UpdateSeoTdk extends Command
574 return $str; 574 return $str;
575 } 575 }
576 576
577 - //前后缀(包括自定义前后缀)如果已经存在,就不在拼接当前类型 后缀只包含了一个,要再拼一个(需去重) 577 + //前后缀(包括自定义前后缀)如果已经存在,就不在拼接当前类型 前、后缀只包含了一个,要再拼一个(需去重)
578 $all_prefixes = $this->getAllPrefix(1, $project_id); 578 $all_prefixes = $this->getAllPrefix(1, $project_id);
579 $all_prefixes = array_map('strtolower', $all_prefixes); 579 $all_prefixes = array_map('strtolower', $all_prefixes);
580 580
@@ -595,9 +595,15 @@ class UpdateSeoTdk extends Command @@ -595,9 +595,15 @@ class UpdateSeoTdk extends Command
595 $i= 0; 595 $i= 0;
596 foreach ($topic_words as $topic_word){ 596 foreach ($topic_words as $topic_word){
597 //关键词本身包含了前缀就不拼前缀,只拼后缀 597 //关键词本身包含了前缀就不拼前缀,只拼后缀
  598 + //关键词本身包含了前缀,可拼后缀,也可以再拼一个不重复的前缀,包含两个前缀就不拼前缀了 2025-10-14 zhl
598 if(in_array($topic_word, $all_prefixes) && $type == 'prefix'){ 599 if(in_array($topic_word, $all_prefixes) && $type == 'prefix'){
  600 + if($i == $num - 1){
599 return $str; 601 return $str;
600 } 602 }
  603 + $ban[] = $topic_word;
  604 + $i++;
  605 + $num--;
  606 + }
601 //关键词本身包含了后缀,可拼前缀,也可以再拼一个不重复的后缀,包含两个后缀就不拼后缀了 607 //关键词本身包含了后缀,可拼前缀,也可以再拼一个不重复的后缀,包含两个后缀就不拼后缀了
602 if(in_array($topic_word, $all_suffixes) && $type == 'suffix'){ 608 if(in_array($topic_word, $all_suffixes) && $type == 'suffix'){
603 //前缀包含一个就不拼了 后缀包含两个才不再拼 609 //前缀包含一个就不拼了 后缀包含两个才不再拼