|
...
|
...
|
@@ -7,9 +7,11 @@ use App\Http\Logic\Bside\BaseLogic; |
|
|
|
use App\Models\Ai\AiBlogAuthor;
|
|
|
|
use App\Models\Ai\AiVideo;
|
|
|
|
use App\Models\Project\AiBlogTask;
|
|
|
|
use App\Models\Project\AiVideoTask;
|
|
|
|
use App\Models\Project\ProjectAiSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\AiBlogService;
|
|
|
|
use App\Services\AiVideoService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :视频模块
|
|
...
|
...
|
@@ -52,10 +54,7 @@ class AiVideoLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function videoSave(){
|
|
|
|
try {
|
|
|
|
if(!empty($this->param['image'])){
|
|
|
|
$this->param['image'] = str_replace_url($this->param['image']);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_VIDEO, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['tit'], RouteMap::SOURCE_AI_VIDEO, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
$aiSettingInfo = $this->getProjectAiSetting();
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
...
|
...
|
@@ -78,16 +77,13 @@ class AiVideoLogic extends BaseLogic |
|
|
|
* @detail :status=1/待执行
|
|
|
|
*/
|
|
|
|
public function sendTask(){
|
|
|
|
$aiSettingInfo = $this->getProjectAiSetting();
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
|
|
|
$aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
|
|
|
|
$result = $aiBlogService->createTask($this->param['keyword'],2,'video',$this->param['anchor'] ?? []);
|
|
|
|
$aiVideoService = new AiVideoService($this->user['project_id']);
|
|
|
|
$result = $aiVideoService->createTask($this->param['title'],$this->param['description'],$this->param['images'],$this->param['anchor'] ?? []);
|
|
|
|
if($result['status'] == 200){
|
|
|
|
$aiBlogTaskModel = new AiBlogTask();
|
|
|
|
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]);
|
|
|
|
$this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'anchor'=>json_encode($this->param['anchor'] ?? [],true)]);
|
|
|
|
$aiVideoTaskModel = new AiVideoTask();
|
|
|
|
$aiVideoTaskModel->addReturnId(['task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id']]);
|
|
|
|
$id = $this->model->addReturnId(['task_id'=>$result['data']['task_id'],'description'=>$this->param['description'],'project_id'=>$this->user['project_id'],'images'=>json_encode($this->param['images'],true),'anchor'=>json_encode($this->param['anchor'] ?? [],true)]);
|
|
|
|
return $this->success(['id'=>$id]);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
...
|
...
|
|