|
@@ -9,7 +9,10 @@ |
|
@@ -9,7 +9,10 @@ |
|
9
|
|
9
|
|
|
10
|
namespace App\Http\Controllers\Bside\BCom;
|
10
|
namespace App\Http\Controllers\Bside\BCom;
|
|
11
|
|
11
|
|
|
|
|
12
|
+use App\Helper\Common;
|
|
12
|
use App\Http\Controllers\Bside\BaseController;
|
13
|
use App\Http\Controllers\Bside\BaseController;
|
|
|
|
14
|
+use App\Models\Blog\Blog;
|
|
|
|
15
|
+use App\Models\News\News;
|
|
13
|
use App\Models\Product\Product;
|
16
|
use App\Models\Product\Product;
|
|
14
|
|
17
|
|
|
15
|
/**
|
18
|
/**
|
|
@@ -42,23 +45,76 @@ class UpdateController extends BaseController |
|
@@ -42,23 +45,76 @@ class UpdateController extends BaseController |
|
42
|
public function updateProduct(){
|
45
|
public function updateProduct(){
|
|
43
|
$productModel = new Product();
|
46
|
$productModel = new Product();
|
|
44
|
$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'],'deleted_at'=>null]);
|
|
|
|
48
|
+ if(!empty($list)){
|
|
45
|
foreach ($list as $k => $v){
|
49
|
foreach ($list as $k => $v){
|
|
46
|
if(!empty($v['seo_mate'])){
|
50
|
if(!empty($v['seo_mate'])){
|
|
47
|
$seo_arr = json_decode($v['seo_mate']);
|
51
|
$seo_arr = json_decode($v['seo_mate']);
|
|
48
|
//更新seo_title
|
52
|
//更新seo_title
|
|
49
|
- if(!isset($seo_arr['title']) || empty($seo_arr['title'])){
|
|
|
|
50
|
-
|
53
|
+ if(!isset($seo_arr['title'])){
|
|
|
|
54
|
+ //生成seo_title
|
|
|
|
55
|
+ $seo_arr['title'] = Com;
|
|
|
|
56
|
+ }
|
|
|
|
57
|
+ //更新seo_keyword
|
|
|
|
58
|
+ if(!isset($seo_arr['keyword'])){
|
|
|
|
59
|
+ $seo_arr['keyword'] = 1;
|
|
51
|
}
|
60
|
}
|
|
52
|
//更新seo_keyword
|
61
|
//更新seo_keyword
|
|
53
|
- if(!isset($seo_arr['keyword']) || empty($seo_arr['keyword'])){
|
62
|
+ if(!isset($seo_arr['description'])){
|
|
|
|
63
|
+ $seo_arr['description'] = 1;
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+ }
|
|
|
|
66
|
+ }
|
|
|
|
67
|
+ }
|
|
|
|
68
|
+ }
|
|
|
|
69
|
+
|
|
|
|
70
|
+ /**
|
|
|
|
71
|
+ * @remark :更新新闻Tdk
|
|
|
|
72
|
+ * @name :updateNews
|
|
|
|
73
|
+ * @author :lyh
|
|
|
|
74
|
+ * @method :post
|
|
|
|
75
|
+ * @time :2023/8/19 10:06
|
|
|
|
76
|
+ */
|
|
|
|
77
|
+ public function updateNews(){
|
|
|
|
78
|
+ $newsModel = new News();
|
|
|
|
79
|
+ $list = $newsModel->list(['status'=>$newsModel::STATUS_ONE]);
|
|
|
|
80
|
+ if(!empty($list)){
|
|
|
|
81
|
+ foreach ($list as $k => $v){
|
|
54
|
|
82
|
|
|
55
|
}
|
83
|
}
|
|
|
|
84
|
+ }
|
|
|
|
85
|
+ }
|
|
56
|
|
86
|
|
|
57
|
- //更新seo_keyword
|
|
|
|
58
|
- if(!isset($seo_arr['keyword']) || empty($seo_arr['keyword'])){
|
87
|
+ /**
|
|
|
|
88
|
+ * @remark :更新blogTdk
|
|
|
|
89
|
+ * @name :updateBlogs
|
|
|
|
90
|
+ * @author :lyh
|
|
|
|
91
|
+ * @method :post
|
|
|
|
92
|
+ * @time :2023/8/19 10:07
|
|
|
|
93
|
+ */
|
|
|
|
94
|
+ public function updateBlogs(){
|
|
|
|
95
|
+ $blogModel = new Blog();
|
|
|
|
96
|
+ $list = $blogModel->list(['status'=>$blogModel::STATUS_ONE]);
|
|
|
|
97
|
+ if(!empty($list)){
|
|
|
|
98
|
+ foreach ($list as $k => $v){
|
|
59
|
|
99
|
|
|
60
|
}
|
100
|
}
|
|
61
|
}
|
101
|
}
|
|
62
|
}
|
102
|
}
|
|
|
|
103
|
+
|
|
|
|
104
|
+ /**
|
|
|
|
105
|
+ * @remark :AI发送
|
|
|
|
106
|
+ * @name :ai_send
|
|
|
|
107
|
+ * @author :lyh
|
|
|
|
108
|
+ * @method :post
|
|
|
|
109
|
+ * @time :2023/8/19 10:40
|
|
|
|
110
|
+ */
|
|
|
|
111
|
+ public function ai_send($key,$keywords){
|
|
|
|
112
|
+ $chat_url = 'v2/openai_chat';
|
|
|
|
113
|
+ $param = [
|
|
|
|
114
|
+ 'key'=>$key,
|
|
|
|
115
|
+ 'keywords'=>$keywords,
|
|
|
|
116
|
+ ];
|
|
|
|
117
|
+ $data = Common::send_openai_msg($chat_url,$param);
|
|
|
|
118
|
+
|
|
63
|
}
|
119
|
}
|
|
64
|
} |
120
|
} |