|
...
|
...
|
@@ -32,7 +32,10 @@ class UpdateController extends BaseController |
|
|
|
* @time :2023/8/19 9:25
|
|
|
|
*/
|
|
|
|
public function updateSeoTdk(){
|
|
|
|
|
|
|
|
$this->updateProduct();
|
|
|
|
$this->updateBlogs();
|
|
|
|
$this->updateNews();
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -60,7 +63,7 @@ class UpdateController extends BaseController |
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['description'])){
|
|
|
|
$seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);;
|
|
|
|
$seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);
|
|
|
|
}
|
|
|
|
$ser_str = json_encode($seo_arr,true);
|
|
|
|
$productModel->edit(['seo_mate'=>$ser_str],['id'=>$v['id']]);
|
|
...
|
...
|
@@ -79,20 +82,23 @@ class UpdateController extends BaseController |
|
|
|
*/
|
|
|
|
public function updateNews(){
|
|
|
|
$newsModel = new News();
|
|
|
|
$list = $newsModel->list(['status'=>$newsModel::STATUS_ONE]);
|
|
|
|
$list = $newsModel->list(['status'=>$newsModel::STATUS_ONE],'id',['id','name','seo_title','seo_keywords','seo_description']);
|
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $k => $v){
|
|
|
|
if(!empty($v['seo_title'])){
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('news_seo_title',$v['name']);
|
|
|
|
}
|
|
|
|
if(!empty($v['seo_keywords'])){
|
|
|
|
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('news_seo_keyword',$v['name']);
|
|
|
|
}
|
|
|
|
if(!empty($v['seo_description'])){
|
|
|
|
|
|
|
|
if(empty($v['seo_description'])){
|
|
|
|
$data['seo_description'] = $this->ai_send('news_seo_description',$v['name']);
|
|
|
|
}
|
|
|
|
$newsModel->edit($data,['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -107,9 +113,20 @@ class UpdateController extends BaseController |
|
|
|
$list = $blogModel->list(['status'=>$blogModel::STATUS_ONE]);
|
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $k => $v){
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']);
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('blog_seo_keyword',$v['name']);
|
|
|
|
}
|
|
|
|
if(empty($v['seo_description'])){
|
|
|
|
$data['seo_description'] = $this->ai_send('blog_seo_description',$v['name']);
|
|
|
|
}
|
|
|
|
$blogModel->edit($data,['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|