|
...
|
...
|
@@ -63,7 +63,7 @@ class AiVideoAutoPublish extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :普通项目--自动发布
|
|
|
|
* @remark :自动发布aiVideo组装数据(写入一条记录)
|
|
|
|
* @name :auto_six_publish
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
...
|
...
|
@@ -73,7 +73,7 @@ class AiVideoAutoPublish extends Command |
|
|
|
$this->output('开始自动发布Video文章');
|
|
|
|
$projectModel = new Project();
|
|
|
|
$optimizeModel = new DeployOptimize();
|
|
|
|
$projectList = $projectModel->list(['is_ai_video'=>1,'id'=>1,'delete_status'=>0,'site_status'=>0,'extend_type'=>0],'id',['id','project_type']);
|
|
|
|
$projectList = $projectModel->list(['is_ai_video'=>1,'delete_status'=>0,'site_status'=>0,'extend_type'=>0],'id',['id','project_type']);
|
|
|
|
foreach ($projectList as $item){
|
|
|
|
$this->output("项目{$item['id']}开始自动发布");
|
|
|
|
//获取当前是否开启自动发布aiVideo
|
|
...
|
...
|
@@ -129,10 +129,7 @@ class AiVideoAutoPublish extends Command |
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
$data['title'] = $info['title'];
|
|
|
|
$data['remark'] = strip_tags($info['intro']);
|
|
|
|
if(empty($data['remark'])){
|
|
|
|
$data['remark'] = $data['title'];
|
|
|
|
}
|
|
|
|
$data['remark'] = $info['intro'];
|
|
|
|
$data['images'] = array_filter(array_map(function ($item) use ($data) {
|
|
|
|
if (!empty($item['url'])) {
|
|
|
|
return [
|
|
...
|
...
|
@@ -193,7 +190,6 @@ class AiVideoAutoPublish extends Command |
|
|
|
}
|
|
|
|
$item = $aiVideoAutoLogModel->read(['status'=>0,'trigger_id'=>null]);
|
|
|
|
if($item === false){
|
|
|
|
echo date('Y-m-d H:i:s').':无生成图片的数据。'.PHP_EOL;
|
|
|
|
sleep(60);
|
|
|
|
continue;
|
|
|
|
}
|
|
...
|
...
|
@@ -204,7 +200,7 @@ class AiVideoAutoPublish extends Command |
|
|
|
$midJourneyService = new MidJourneyService();
|
|
|
|
$result = $midJourneyService->imagine($content);
|
|
|
|
if($result && !empty($result['trigger_id'])){
|
|
|
|
echo '提交的数据详情。'.json_encode($result,true).$item['project_id'].PHP_EOL;
|
|
|
|
echo '提交的数据详情。'.json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).$item['project_id'].PHP_EOL;
|
|
|
|
Redis::incr('ai_video_image');
|
|
|
|
$aiVideoAutoLogModel->edit(['trigger_id'=>$result['trigger_id']],['id'=>$item['id']]);
|
|
|
|
}
|
|
...
|
...
|
@@ -241,14 +237,17 @@ class AiVideoAutoPublish extends Command |
|
|
|
$aiVideoService = new AiVideoService($info['project_id']);
|
|
|
|
$projectModel = new DeployOptimize();
|
|
|
|
$video_setting = $projectModel->getValue(['project_id'=>$info['project_id']],'video_setting');
|
|
|
|
$frequency_setting = $projectModel->getValue(['project_id'=>$info['project_id']],'send_ai_video_frequency');
|
|
|
|
$storage = $aiVideoTaskModel->videoSetting()[$video_setting ?? 1];
|
|
|
|
$frequency = $aiVideoTaskModel->videoFrequency()[$frequency_setting ?? 1];
|
|
|
|
$frequencyArr = explode('-',$frequency);
|
|
|
|
$result = $aiVideoService->createTask($info['title'],$info['remark'],$info['images'],[],$storage);
|
|
|
|
if($result['status'] == 200){
|
|
|
|
$aiVideoTaskModel->addReturnId(['task_id'=>$result['data']['task_id'],'project_id'=>$info['project_id'],'storage'=>$storage]);
|
|
|
|
$next_auto_date = date('Y-m-d', strtotime('+' . mt_rand($frequencyArr[0] ?? 5,$frequencyArr[1] ?? 7) . 'days')); //每5-7天自动发布
|
|
|
|
$aiVideoTaskModel->addReturnId(['next_auto_date'=>$next_auto_date,'task_id'=>$result['data']['task_id'],'project_id'=>$info['project_id'],'storage'=>$storage]);
|
|
|
|
ProjectServer::useProject($info['project_id']);
|
|
|
|
$aiVideoModel = new AiVideo();
|
|
|
|
$next_auto_date = date('Y-m-d', strtotime('+' . mt_rand(5,7) . 'days')); //每5-7天自动发布
|
|
|
|
$aiVideoModel->addReturnId(['next_auto_date'=>$next_auto_date,'title'=>$info['title'],'task_id'=>$result['data']['task_id'],'description'=>$info['remark'],'project_id'=>$info['project_id'],'images'=>json_encode($info['images'],true),'anchor'=>json_encode([],true)]);
|
|
|
|
$aiVideoModel->addReturnId(['title'=>$info['title'],'task_id'=>$result['data']['task_id'],'description'=>$info['remark'],'project_id'=>$info['project_id'],'images'=>json_encode($info['images'],true),'anchor'=>json_encode([],true)]);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$aiVideoAutoLogModel->edit(['status'=>2],['id'=>$info['id']]);
|
|
|
|
}
|
|
...
|
...
|
@@ -289,7 +288,7 @@ class AiVideoAutoPublish extends Command |
|
|
|
* @method :post
|
|
|
|
* @time :2025/8/1 16:25
|
|
|
|
*/
|
|
|
|
public function getAiVideoParam($project_id = 3751)
|
|
|
|
public function getAiVideoParam($project_id)
|
|
|
|
{
|
|
|
|
//获取当前网站域名
|
|
|
|
$domainModel = new DomainInfo();
|
...
|
...
|
|