|
...
|
...
|
@@ -80,24 +80,22 @@ class UpdateSeoTdk extends Command |
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $v){
|
|
|
|
$v = (array)$v;
|
|
|
|
if(!empty($v['seo_mate'])){
|
|
|
|
$seo_arr = json_decode($v['seo_mate'], true);
|
|
|
|
//更新seo_title
|
|
|
|
if(!isset($seo_arr['title'])){
|
|
|
|
//生成seo_title
|
|
|
|
$seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']);
|
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['keyword'])){
|
|
|
|
$seo_arr['keyword'] = $this->ai_send('product_seo_keyword',$v['title']);
|
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['description'])){
|
|
|
|
$seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);
|
|
|
|
}
|
|
|
|
$ser_str = json_encode($seo_arr,true);
|
|
|
|
DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update(['seo_mate'=>$ser_str]);
|
|
|
|
$seo_arr = json_decode($v['seo_mate'], true) ?: [];
|
|
|
|
//更新seo_title
|
|
|
|
if(!isset($seo_arr['title'])){
|
|
|
|
//生成seo_title
|
|
|
|
$seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']);
|
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['keyword'])){
|
|
|
|
$seo_arr['keyword'] = $this->ai_send('product_seo_keyword',$v['title']);
|
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['description'])){
|
|
|
|
$seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);
|
|
|
|
}
|
|
|
|
$ser_str = json_encode($seo_arr,true);
|
|
|
|
DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update(['seo_mate'=>$ser_str]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
...
|
...
|
|