|
@@ -44,7 +44,7 @@ class UpdateController extends BaseController |
|
@@ -44,7 +44,7 @@ class UpdateController extends BaseController |
|
44
|
*/
|
44
|
*/
|
|
45
|
public function updateProduct(){
|
45
|
public function updateProduct(){
|
|
46
|
$productModel = new Product();
|
46
|
$productModel = new Product();
|
|
47
|
- $list = $productModel->list(['status'=>Product::STATUS_ON,'project_id'=>$this->user['project_id'],'deleted_at'=>null]);
|
47
|
+ $list = $productModel->list(['status'=>Product::STATUS_ON,'project_id'=>$this->user['project_id']],'id',['id','seo_mate']);
|
|
48
|
if(!empty($list)){
|
48
|
if(!empty($list)){
|
|
49
|
foreach ($list as $k => $v){
|
49
|
foreach ($list as $k => $v){
|
|
50
|
if(!empty($v['seo_mate'])){
|
50
|
if(!empty($v['seo_mate'])){
|
|
@@ -52,19 +52,24 @@ class UpdateController extends BaseController |
|
@@ -52,19 +52,24 @@ class UpdateController extends BaseController |
|
52
|
//更新seo_title
|
52
|
//更新seo_title
|
|
53
|
if(!isset($seo_arr['title'])){
|
53
|
if(!isset($seo_arr['title'])){
|
|
54
|
//生成seo_title
|
54
|
//生成seo_title
|
|
55
|
- $seo_arr['title'] = Com;
|
55
|
+ $seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']);
|
|
|
|
56
|
+ var_dump($seo_arr);
|
|
|
|
57
|
+ die();
|
|
56
|
}
|
58
|
}
|
|
57
|
//更新seo_keyword
|
59
|
//更新seo_keyword
|
|
58
|
if(!isset($seo_arr['keyword'])){
|
60
|
if(!isset($seo_arr['keyword'])){
|
|
59
|
- $seo_arr['keyword'] = 1;
|
61
|
+ $seo_arr['keyword'] = $this->ai_send('product_seo_keyword',$v['title']);
|
|
60
|
}
|
62
|
}
|
|
61
|
//更新seo_keyword
|
63
|
//更新seo_keyword
|
|
62
|
if(!isset($seo_arr['description'])){
|
64
|
if(!isset($seo_arr['description'])){
|
|
63
|
- $seo_arr['description'] = 1;
|
65
|
+ $seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);;
|
|
64
|
}
|
66
|
}
|
|
|
|
67
|
+ $ser_str = json_decode($seo_arr);
|
|
|
|
68
|
+ $productModel->edit(['seo_mate'=>$ser_str],['id'=>$v['id']]);
|
|
65
|
}
|
69
|
}
|
|
66
|
}
|
70
|
}
|
|
67
|
}
|
71
|
}
|
|
|
|
72
|
+ return true;
|
|
68
|
}
|
73
|
}
|
|
69
|
|
74
|
|
|
70
|
/**
|
75
|
/**
|
|
@@ -115,6 +120,6 @@ class UpdateController extends BaseController |
|
@@ -115,6 +120,6 @@ class UpdateController extends BaseController |
|
115
|
'keywords'=>$keywords,
|
120
|
'keywords'=>$keywords,
|
|
116
|
];
|
121
|
];
|
|
117
|
$data = Common::send_openai_msg($chat_url,$param);
|
122
|
$data = Common::send_openai_msg($chat_url,$param);
|
|
118
|
-
|
123
|
+ return $data;
|
|
119
|
}
|
124
|
}
|
|
120
|
} |
125
|
} |