|
@@ -9,6 +9,7 @@ |
|
@@ -9,6 +9,7 @@ |
|
9
|
|
9
|
|
|
10
|
namespace App\Console\Commands\Ai;
|
10
|
namespace App\Console\Commands\Ai;
|
|
11
|
|
11
|
|
|
|
|
12
|
+use App\Models\Product\Keyword;
|
|
12
|
use App\Models\Product\Product;
|
13
|
use App\Models\Product\Product;
|
|
13
|
use App\Models\Project\DeployOptimize;
|
14
|
use App\Models\Project\DeployOptimize;
|
|
14
|
use App\Models\Project\Project;
|
15
|
use App\Models\Project\Project;
|
|
@@ -77,7 +78,11 @@ class AiVideoAutoPublish extends Command |
|
@@ -77,7 +78,11 @@ class AiVideoAutoPublish extends Command |
|
77
|
}
|
78
|
}
|
|
78
|
//获取当前网站的标题
|
79
|
//获取当前网站的标题
|
|
79
|
ProjectServer::useProject($item['id']);
|
80
|
ProjectServer::useProject($item['id']);
|
|
80
|
- $data = $this->getProduct();
|
81
|
+ $data = $this->getVideoInfo();
|
|
|
|
82
|
+ if(!empty($data)){
|
|
|
|
83
|
+ //写入一条零时生成视频记录
|
|
|
|
84
|
+
|
|
|
|
85
|
+ }
|
|
81
|
DB::disconnect('custom_mysql');
|
86
|
DB::disconnect('custom_mysql');
|
|
82
|
}
|
87
|
}
|
|
83
|
}
|
88
|
}
|
|
@@ -89,21 +94,37 @@ class AiVideoAutoPublish extends Command |
|
@@ -89,21 +94,37 @@ class AiVideoAutoPublish extends Command |
|
89
|
* @method :post
|
94
|
* @method :post
|
|
90
|
* @time :2025/8/1 16:09
|
95
|
* @time :2025/8/1 16:09
|
|
91
|
*/
|
96
|
*/
|
|
92
|
- public function getProduct(){
|
97
|
+ public function getVideoInfo(){
|
|
93
|
$data = [];
|
98
|
$data = [];
|
|
|
|
99
|
+ $random = rand(1, 2);
|
|
|
|
100
|
+ if($random == 1){//取产品
|
|
94
|
$productModel = new Product();
|
101
|
$productModel = new Product();
|
|
95
|
- $info = $productModel->formatQuery(['gallery'=>['!=',null]])->select(['title','gallery','intro'])->inRandomOrder()->first();
|
102
|
+ $info = $productModel->formatQuery(['title'=>['!=',null],'intro'=>['!=',null]])->select(['title','gallery','intro'])->inRandomOrder()->first();
|
|
96
|
if(empty($info)){
|
103
|
if(empty($info)){
|
|
97
|
return $data;
|
104
|
return $data;
|
|
98
|
}
|
105
|
}
|
|
99
|
$data['title'] = $info['title'];
|
106
|
$data['title'] = $info['title'];
|
|
100
|
$data['remark'] = $info['intro'];
|
107
|
$data['remark'] = $info['intro'];
|
|
101
|
$data['images'] = array_walk($info['gallery'], function (&$item) {$item['alt'] = $item['title'];unset($item['title']);});
|
108
|
$data['images'] = array_walk($info['gallery'], function (&$item) {$item['alt'] = $item['title'];unset($item['title']);});
|
|
102
|
- if(count($data['images']) < 6){
|
|
|
|
103
|
- //todo::需要生成图片
|
109
|
+ return $data;
|
|
|
|
110
|
+ }else{
|
|
|
|
111
|
+ //聚合页获取当前关联产品的图片
|
|
|
|
112
|
+ $keywordModel = new Keyword();
|
|
|
|
113
|
+ $keywordInfo = $keywordModel->formatQuery(['keyword_title'=>['!=',null],'keyword_content'=>['!=',null]])->select(['keyword_title','keyword_content'])->inRandomOrder()->first();
|
|
|
|
114
|
+ if(empty($keywordInfo)){
|
|
|
|
115
|
+ return $data;
|
|
|
|
116
|
+ }
|
|
|
|
117
|
+ $data['title'] = $keywordInfo['title'];
|
|
|
|
118
|
+ $data['remark'] = $keywordInfo['intro'];
|
|
|
|
119
|
+ $data['images'] = [];
|
|
|
|
120
|
+ $productModel = new Product();
|
|
|
|
121
|
+ $productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],'id',['gallery'],'desc',10);
|
|
|
|
122
|
+ foreach ($productList as $info){
|
|
|
|
123
|
+ $data['images'] = array_merge($data['images'],array_walk($info['gallery'], function (&$item) {$item['alt'] = $item['title'];unset($item['title']);}));
|
|
104
|
}
|
124
|
}
|
|
105
|
return $data;
|
125
|
return $data;
|
|
106
|
}
|
126
|
}
|
|
|
|
127
|
+ }
|
|
107
|
|
128
|
|
|
108
|
/**
|
129
|
/**
|
|
109
|
* @remark :
|
130
|
* @remark :
|