正在显示
1 个修改的文件
包含
37 行增加
和
19 行删除
| @@ -141,29 +141,45 @@ class RerunSeoTdk extends Command | @@ -141,29 +141,45 @@ class RerunSeoTdk extends Command | ||
| 141 | // } | 141 | // } |
| 142 | // } | 142 | // } |
| 143 | 143 | ||
| 144 | - /** | ||
| 145 | - * 判断异常 | ||
| 146 | - * @author zbj | ||
| 147 | - * @date 2025/4/12 | ||
| 148 | - */ | ||
| 149 | - public function judgeAnomalies($project_id){ | ||
| 150 | - //获取当前项目的所有分类 | ||
| 151 | - $categories = NewsCategory::pluck('alias', 'id')->toArray(); | ||
| 152 | - //新闻 seo_keyword 和 分类名一样的 | ||
| 153 | - $news_ids = []; | ||
| 154 | - foreach ($categories as $category){ | ||
| 155 | - $ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray(); | ||
| 156 | - $news_ids = array_unique(array_merge($news_ids, $ids)); | ||
| 157 | - } | 144 | +// /** |
| 145 | +// * 判断异常 | ||
| 146 | +// * @author zbj | ||
| 147 | +// * @date 2025/4/12 | ||
| 148 | +// */ | ||
| 149 | +// public function judgeAnomalies($project_id){ | ||
| 150 | +// //获取当前项目的所有分类 | ||
| 151 | +// $categories = NewsCategory::pluck('alias', 'id')->toArray(); | ||
| 152 | +// //新闻 seo_keyword 和 分类名一样的 | ||
| 153 | +// $news_ids = []; | ||
| 154 | +// foreach ($categories as $category){ | ||
| 155 | +// $ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray(); | ||
| 156 | +// $news_ids = array_unique(array_merge($news_ids, $ids)); | ||
| 157 | +// } | ||
| 158 | +// | ||
| 159 | +// $count = count($news_ids); | ||
| 160 | +// if($count){ | ||
| 161 | +// echo "项目{$project_id},共{$count}条需要重跑"; | ||
| 162 | +// News::whereIn('id', $news_ids)->update(['seo_keywords' => '']); | ||
| 163 | +// ProjectUpdateTdk::add_task($project_id); | ||
| 164 | +// } | ||
| 165 | +// } | ||
| 158 | 166 | ||
| 159 | - $count = count($news_ids); | ||
| 160 | - if($count){ | ||
| 161 | - echo "项目{$project_id},共{$count}条需要重跑"; | ||
| 162 | - News::whereIn('id', $news_ids)->update(['seo_keywords' => '']); | ||
| 163 | - ProjectUpdateTdk::add_task($project_id); | 167 | + public function judgeAnomalies($project_id) |
| 168 | + { | ||
| 169 | + $page_title = Keyword::where('keyword_title', 'like', '%qz_1%')->orWhere('keyword_title', 'like', '%qz_2%')->update(['keyword_title' => '']); | ||
| 170 | + $page_content = Keyword::where('keyword_content', 'like', '%qz_1%')->orWhere('keyword_content', 'like', '%qz_2%')->update(['keyword_content' => '']); | ||
| 171 | + $seo_description = Keyword::where('seo_description', 'like', '%qz_1%')->orWhere('seo_description', 'like', '%qz_2%')->update(['seo_description' => '']); | ||
| 172 | + | ||
| 173 | + if($page_title || $page_content || $seo_description){ | ||
| 174 | + echo "项目{$project_id},需要重跑"; | ||
| 175 | + dump($page_title); | ||
| 176 | + dump($page_content); | ||
| 177 | + dump($seo_description); | ||
| 164 | } | 178 | } |
| 165 | } | 179 | } |
| 166 | 180 | ||
| 181 | + | ||
| 182 | + | ||
| 167 | public function getAllPrefix($type, int $project_id = 0){ | 183 | public function getAllPrefix($type, int $project_id = 0){ |
| 168 | $cache_key = 'AllPrefix_' . $type . '_' . $project_id; | 184 | $cache_key = 'AllPrefix_' . $type . '_' . $project_id; |
| 169 | $data = Cache::get($cache_key); | 185 | $data = Cache::get($cache_key); |
| @@ -173,4 +189,6 @@ class RerunSeoTdk extends Command | @@ -173,4 +189,6 @@ class RerunSeoTdk extends Command | ||
| 173 | } | 189 | } |
| 174 | return $data; | 190 | return $data; |
| 175 | } | 191 | } |
| 192 | + | ||
| 193 | + | ||
| 176 | } | 194 | } |
-
请 注册 或 登录 后发表评论