合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !2814
正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
| @@ -174,33 +174,33 @@ class AiBlogLogic extends BaseLogic | @@ -174,33 +174,33 @@ class AiBlogLogic extends BaseLogic | ||
| 174 | if(empty($param['route'])){ | 174 | if(empty($param['route'])){ |
| 175 | $param['route'] = generateRoute(Translate::tran($param['new_title'], 'en')); | 175 | $param['route'] = generateRoute(Translate::tran($param['new_title'], 'en')); |
| 176 | } | 176 | } |
| 177 | + //推送到ai的数据结构 | ||
| 177 | $data = [ | 178 | $data = [ |
| 178 | - 'title'=>$param['new_title'], | ||
| 179 | - 'thumb'=>$param['image'], | ||
| 180 | - 'foreword'=>$param['description'], | ||
| 181 | - 'author_id'=>$this->param['author_id'], | ||
| 182 | - 'url'=>$param['route'], | 179 | + 'title'=>$param['new_title'], 'thumb'=>$param['image'], 'foreword'=>$param['description'], |
| 180 | + 'author_id'=>$this->param['author_id'], 'url'=>$param['route'], | ||
| 183 | ]; | 181 | ]; |
| 184 | if(isset($param['id']) && !empty($param['id'])){ | 182 | if(isset($param['id']) && !empty($param['id'])){ |
| 183 | + $id = $param['id']; | ||
| 185 | $data['task_id'] = $param['task_id']; | 184 | $data['task_id'] = $param['task_id']; |
| 185 | + $param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); | ||
| 186 | $this->model->edit($param,['id'=>$param['id']]); | 186 | $this->model->edit($param,['id'=>$param['id']]); |
| 187 | - $id = $param['id']; | ||
| 188 | }else{ | 187 | }else{ |
| 189 | $param['uuid'] = md5(date('YmdHis').rand(100,999).$this->user['project_id']); | 188 | $param['uuid'] = md5(date('YmdHis').rand(100,999).$this->user['project_id']); |
| 190 | $param['project_id'] = $this->user['project_id']; | 189 | $param['project_id'] = $this->user['project_id']; |
| 190 | + $param['status'] = $this->model::STATUS_RUNNING; | ||
| 191 | $id = $this->model->addReturnId($param); | 191 | $id = $this->model->addReturnId($param); |
| 192 | + $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); | ||
| 193 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 192 | } | 194 | } |
| 193 | - $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); | ||
| 194 | - $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 195 | }catch (\Exception $e){ | 195 | }catch (\Exception $e){ |
| 196 | $this->fail('保存失败,请联系管理员'); | 196 | $this->fail('保存失败,请联系管理员'); |
| 197 | } | 197 | } |
| 198 | $aiBlogService = new AiBlogService($this->user['project_id']); | 198 | $aiBlogService = new AiBlogService($this->user['project_id']); |
| 199 | $result = $aiBlogService->createCustomBlog($data); | 199 | $result = $aiBlogService->createCustomBlog($data); |
| 200 | - if($result['status'] == 200){ | ||
| 201 | - $this->model->edit(['task_id'=>$result['data']['task_id']],['id'=>$id]); | 200 | + if(isset($result['status']) && $result['status'] == 200){ |
| 201 | + $this->model->edit(['task_id'=>$result['data']['task_id'],'status'=>$this->model::STATUS_FINISH],['id'=>$id]); | ||
| 202 | //todo::更新列表页 | 202 | //todo::更新列表页 |
| 203 | - shell_exec("php artisan save_ai_blog_list {$this->user['project_id']} > /dev/null 2>&1 &"); | 203 | + shell_exec("php artisan save_ai_blog_list {$this->user['project_id']} > /dev/null 2>&1 &"); |
| 204 | } | 204 | } |
| 205 | return $this->success(); | 205 | return $this->success(); |
| 206 | } | 206 | } |
-
请 注册 或 登录 后发表评论