作者 赵彬吉

update

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