作者 lyh

gx

... ... @@ -60,9 +60,6 @@ class AiVideoAutoPublish extends Command
if($action == 'auto_save_video_task'){
$this->auto_save_video_task();
}
if($action == 'getAiVideoParam'){
$this->getAiVideoParam();
}
}
/**
... ... @@ -76,7 +73,7 @@ class AiVideoAutoPublish extends Command
$this->output('开始自动发布Video文章');
$projectModel = new Project();
$optimizeModel = new DeployOptimize();
$projectList = $projectModel->list(['is_ai_video'=>1,'delete_status'=>0,'site_status'=>0,'extend_type'=>0],'id',['id']);
$projectList = $projectModel->list(['is_ai_video'=>1,'id'=>3751,'delete_status'=>0,'site_status'=>0,'extend_type'=>0],'id',['id']);
foreach ($projectList as $item){
$this->output("项目{$item['id']}开始自动发布");
//获取当前是否开启自动发布aiVideo
... ... @@ -97,20 +94,22 @@ class AiVideoAutoPublish extends Command
}
if($item['project_type'] == 1){
//todo::页面上获取数据
$data = $this->getAiVideoParam($item['id']);
}else{
//获取当前网站的标题
ProjectServer::useProject($item['id']);
$data = $this->getVideoInfo();
if(!empty($data)){
//写入一条零时生成视频记录
$aiVideoAutoLogModel = new AiVideoAutoLog();
$aiVideoAutoLogModel->addReturnId(
['project_id'=>$item['id'],'title'=>$data['title'],'remark'=>$data['remark'],'images'=>json_encode($data['images'],true),'date'=>date('Y-m-d')]
);
}
DB::disconnect('custom_mysql');
}
if(!empty($data)){
//写入一条零时生成视频记录
$aiVideoAutoLogModel = new AiVideoAutoLog();
$aiVideoAutoLogModel->addReturnId(
['project_id'=>$item['id'],'title'=>$data['title'],'remark'=>$data['remark'],'images'=>json_encode($data['images'],true),'date'=>date('Y-m-d')]
);
}
DB::disconnect('custom_mysql');
}
return true;
}
/**
... ... @@ -328,9 +327,9 @@ class AiVideoAutoPublish extends Command
$num++;
goto AGAIN;
}
dd(['title'=>$title,'remark'=>$content,'images'=>$images]);
return ['title'=>$title,'remark'=>$content,'images'=>$images];
} catch (\Exception $e) {
$this->output('project_id: ' . $project_id . ', domain: ' . $domain . ', error: ' . $e->getMessage());
echo 'project_id: ' . $project_id . ', domain: ' . $domain . ', error: ' . $e->getMessage() . PHP_EOL;
}
}
... ...