作者 zhl

关键词中有前后缀,就不拼接对应关键词

@@ -371,7 +371,7 @@ class UpdateSeoTdk extends Command @@ -371,7 +371,7 @@ class UpdateSeoTdk extends Command
371 if (empty($prefix) || empty($suffix)) 371 if (empty($prefix) || empty($suffix))
372 continue; 372 continue;
373 $seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix; 373 $seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix;
374 - $data[$field] = $seo_title; 374 + $data[$field] = trim($seo_title);
375 $update[$table]['title']++; 375 $update[$table]['title']++;
376 } else if ($table == 'gl_ai_blog_list' && $field == 'seo_title') { 376 } else if ($table == 'gl_ai_blog_list' && $field == 'seo_title') {
377 //直接使用 top blog 377 //直接使用 top blog
@@ -547,6 +547,9 @@ class UpdateSeoTdk extends Command @@ -547,6 +547,9 @@ class UpdateSeoTdk extends Command
547 //去掉标题存在的词 547 //去掉标题存在的词
548 if ($topic) { 548 if ($topic) {
549 foreach ($fix_keyword as $k=>$keyword) { 549 foreach ($fix_keyword as $k=>$keyword) {
  550 + // 前后缀如果已经存在, 就不在拼接当前类型
  551 + if (FALSE !== strpos($topic, $keyword))
  552 + return $str;
550 //处理单词复数 s es ies ves 553 //处理单词复数 s es ies ves
551 $keyword = rtrim($keyword, 'ves'); 554 $keyword = rtrim($keyword, 'ves');
552 $keyword = rtrim($keyword, 'ies'); 555 $keyword = rtrim($keyword, 'ies');