作者 刘锟

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

... ... @@ -47,6 +47,8 @@ class lyhDemo extends Command
try {
$settingModel = new WebSetting();
$settingModel->edit(['anchor_num'=>10],['id'=>1,'anchor_num'=>3]);
$settingModel->edit(['anchor_num'=>3],['id'=>1,'anchor_num'=>1]);
$settingModel->edit(['anchor_num'=>5],['id'=>1,'anchor_num'=>2]);
}catch (\Exception $e){
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -141,29 +141,45 @@ class RerunSeoTdk extends Command
// }
// }
/**
* 判断异常
* @author zbj
* @date 2025/4/12
*/
public function judgeAnomalies($project_id){
//获取当前项目的所有分类
$categories = NewsCategory::pluck('alias', 'id')->toArray();
//新闻 seo_keyword 和 分类名一样的
$news_ids = [];
foreach ($categories as $category){
$ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray();
$news_ids = array_unique(array_merge($news_ids, $ids));
}
// /**
// * 判断异常
// * @author zbj
// * @date 2025/4/12
// */
// public function judgeAnomalies($project_id){
// //获取当前项目的所有分类
// $categories = NewsCategory::pluck('alias', 'id')->toArray();
// //新闻 seo_keyword 和 分类名一样的
// $news_ids = [];
// foreach ($categories as $category){
// $ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray();
// $news_ids = array_unique(array_merge($news_ids, $ids));
// }
//
// $count = count($news_ids);
// if($count){
// echo "项目{$project_id},共{$count}条需要重跑";
// News::whereIn('id', $news_ids)->update(['seo_keywords' => '']);
// ProjectUpdateTdk::add_task($project_id);
// }
// }
$count = count($news_ids);
if($count){
echo "项目{$project_id},共{$count}条需要重跑";
News::whereIn('id', $news_ids)->update(['seo_keywords' => '']);
ProjectUpdateTdk::add_task($project_id);
public function judgeAnomalies($project_id)
{
$page_title = Keyword::where('keyword_title', 'like', '%qz_1%')->orWhere('keyword_title', 'like', '%qz_2%')->update(['keyword_title' => '']);
$page_content = Keyword::where('keyword_content', 'like', '%qz_1%')->orWhere('keyword_content', 'like', '%qz_2%')->update(['keyword_content' => '']);
$seo_description = Keyword::where('seo_description', 'like', '%qz_1%')->orWhere('seo_description', 'like', '%qz_2%')->update(['seo_description' => '']);
if($page_title || $page_content || $seo_description){
echo "项目{$project_id},需要重跑";
dump($page_title);
dump($page_content);
dump($seo_description);
}
}
public function getAllPrefix($type, int $project_id = 0){
$cache_key = 'AllPrefix_' . $type . '_' . $project_id;
$data = Cache::get($cache_key);
... ... @@ -173,4 +189,6 @@ class RerunSeoTdk extends Command
}
return $data;
}
}
... ...
... ... @@ -68,12 +68,19 @@ class AggregationSettingController extends BaseController
if($number > 1){
$this->param['top_banner'] = array_slice($this->param['top_banner'], 1);
}
}else{
if(empty($info['image'])){
$settingImageModel->edit(['image'=>reset($this->param['top_banner'])],['type'=>4,'project_id'=>$this->user['project_id']]);
if($number > 1){
$this->param['top_banner'] = array_slice($this->param['top_banner'], 1);
}
}
}
if($number > 3){
$this->param['top_banner'] = array_slice($this->param['top_banner'], 0, 3);
}
$this->param['top_banner'] = Arr::a2s($this->param['top_banner']);
}
$this->param['top_banner'] = Arr::a2s($this->param['top_banner'] ?? []);
if(isset($this->param['foot_banner']) && !empty($this->param['foot_banner'])){
$this->param['foot_banner'] = Arr::a2s($this->param['foot_banner']);
}
... ...