作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -47,6 +47,8 @@ class lyhDemo extends Command @@ -47,6 +47,8 @@ class lyhDemo extends Command
47 try { 47 try {
48 $settingModel = new WebSetting(); 48 $settingModel = new WebSetting();
49 $settingModel->edit(['anchor_num'=>10],['id'=>1,'anchor_num'=>3]); 49 $settingModel->edit(['anchor_num'=>10],['id'=>1,'anchor_num'=>3]);
  50 + $settingModel->edit(['anchor_num'=>3],['id'=>1,'anchor_num'=>1]);
  51 + $settingModel->edit(['anchor_num'=>5],['id'=>1,'anchor_num'=>2]);
50 }catch (\Exception $e){ 52 }catch (\Exception $e){
51 DB::disconnect('custom_mysql'); 53 DB::disconnect('custom_mysql');
52 } 54 }
@@ -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 }
@@ -68,12 +68,19 @@ class AggregationSettingController extends BaseController @@ -68,12 +68,19 @@ class AggregationSettingController extends BaseController
68 if($number > 1){ 68 if($number > 1){
69 $this->param['top_banner'] = array_slice($this->param['top_banner'], 1); 69 $this->param['top_banner'] = array_slice($this->param['top_banner'], 1);
70 } 70 }
  71 + }else{
  72 + if(empty($info['image'])){
  73 + $settingImageModel->edit(['image'=>reset($this->param['top_banner'])],['type'=>4,'project_id'=>$this->user['project_id']]);
  74 + if($number > 1){
  75 + $this->param['top_banner'] = array_slice($this->param['top_banner'], 1);
  76 + }
  77 + }
71 } 78 }
72 if($number > 3){ 79 if($number > 3){
73 $this->param['top_banner'] = array_slice($this->param['top_banner'], 0, 3); 80 $this->param['top_banner'] = array_slice($this->param['top_banner'], 0, 3);
74 } 81 }
75 - $this->param['top_banner'] = Arr::a2s($this->param['top_banner']);  
76 } 82 }
  83 + $this->param['top_banner'] = Arr::a2s($this->param['top_banner'] ?? []);
77 if(isset($this->param['foot_banner']) && !empty($this->param['foot_banner'])){ 84 if(isset($this->param['foot_banner']) && !empty($this->param['foot_banner'])){
78 $this->param['foot_banner'] = Arr::a2s($this->param['foot_banner']); 85 $this->param['foot_banner'] = Arr::a2s($this->param['foot_banner']);
79 } 86 }