|
...
|
...
|
@@ -28,8 +28,11 @@ class AiBlogLogic extends BaseLogic |
|
|
|
* @time :2023/7/5 14:46
|
|
|
|
*/
|
|
|
|
public function blogSave(){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$rs = $this->model->add($this->param);
|
|
|
|
if(!empty($this->param['image'])){
|
|
|
|
$this->param['image'] = str_replace_url($this->param['image']);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
...
|
...
|
@@ -57,15 +60,13 @@ class AiBlogLogic extends BaseLogic |
|
|
|
}
|
|
|
|
$result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']);
|
|
|
|
if($result['status'] == 200){
|
|
|
|
try {
|
|
|
|
$aiBlogTaskModel = new AiBlogTask();
|
|
|
|
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]);
|
|
|
|
$aiBlogModel = new AiBlog();
|
|
|
|
$aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
|
|
|
|
]);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('请求ai_blog失败,请联系管理员');
|
|
|
|
}
|
|
|
|
$aiBlogTaskModel = new AiBlogTask();
|
|
|
|
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]);
|
|
|
|
$aiBlogModel = new AiBlog();
|
|
|
|
$aiBlogId = $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
|
|
|
|
]);
|
|
|
|
$route = RouteMap::setRoute($aiBlogService->route, RouteMap::SOURCE_AI_BLOG, $aiBlogId, $this->user['project_id']);
|
|
|
|
$aiBlogModel->edit(['route'=>$route],['id'=>$aiBlogId]);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
...
|
...
|
|