正在显示
5 个修改的文件
包含
31 行增加
和
5 行删除
| @@ -114,7 +114,7 @@ class AiBlogAuthorTask extends Command | @@ -114,7 +114,7 @@ class AiBlogAuthorTask extends Command | ||
| 114 | $param = [ | 114 | $param = [ |
| 115 | 'author_id'=>$v['id'], | 115 | 'author_id'=>$v['id'], |
| 116 | 'title'=>$v['title'], | 116 | 'title'=>$v['title'], |
| 117 | - 'image'=>$v['picture'], | 117 | + 'image'=>str_replace_url($v['picture']), |
| 118 | 'description'=>$v['description'], | 118 | 'description'=>$v['description'], |
| 119 | ]; | 119 | ]; |
| 120 | $id = $aiBlogAuthorModel->addReturnId($param); | 120 | $id = $aiBlogAuthorModel->addReturnId($param); |
| @@ -63,7 +63,7 @@ class AiBlogTask extends Command | @@ -63,7 +63,7 @@ class AiBlogTask extends Command | ||
| 63 | //保存当前项目ai_blog数据 | 63 | //保存当前项目ai_blog数据 |
| 64 | ProjectServer::useProject($info['project_id']); | 64 | ProjectServer::useProject($info['project_id']); |
| 65 | $aiBlogModel = new AiBlog(); | 65 | $aiBlogModel = new AiBlog(); |
| 66 | - $aiBlogModel->edit(['new_title'=>$result['data']['title'],'image'=>$result['data']['thumb'],'text'=>$result['data']['section'],'status'=>2],['task_id'=>$info['task_id']]); | 66 | + $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'status'=>2], ['task_id'=>$info['task_id']]); |
| 67 | $this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']); | 67 | $this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']); |
| 68 | DB::disconnect('custom_mysql'); | 68 | DB::disconnect('custom_mysql'); |
| 69 | //修改任务状态 | 69 | //修改任务状态 |
| @@ -41,6 +41,7 @@ class AiBlogController extends BaseController | @@ -41,6 +41,7 @@ class AiBlogController extends BaseController | ||
| 41 | 'id.required' => '主键不能为空', | 41 | 'id.required' => '主键不能为空', |
| 42 | ]); | 42 | ]); |
| 43 | $info = $aiBlog->read(['id'=>$this->param['id']]); | 43 | $info = $aiBlog->read(['id'=>$this->param['id']]); |
| 44 | + $info['image'] = getImageUrl($info['image']); | ||
| 44 | $this->response('success',Code::SUCCESS,$info); | 45 | $this->response('success',Code::SUCCESS,$info); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| @@ -129,6 +130,7 @@ class AiBlogController extends BaseController | @@ -129,6 +130,7 @@ class AiBlogController extends BaseController | ||
| 129 | 'id.required' => '主键不能为空', | 130 | 'id.required' => '主键不能为空', |
| 130 | ]); | 131 | ]); |
| 131 | $info = $aiBlogAuthor->read($this->map); | 132 | $info = $aiBlogAuthor->read($this->map); |
| 133 | + $info['image'] = getImageUrl($info['image']); | ||
| 132 | $this->response('success',Code::SUCCESS,$info); | 134 | $this->response('success',Code::SUCCESS,$info); |
| 133 | } | 135 | } |
| 134 | } | 136 | } |
| @@ -28,13 +28,14 @@ class AiBlogLogic extends BaseLogic | @@ -28,13 +28,14 @@ class AiBlogLogic extends BaseLogic | ||
| 28 | * @time :2023/7/5 14:46 | 28 | * @time :2023/7/5 14:46 |
| 29 | */ | 29 | */ |
| 30 | public function blogSave(){ | 30 | public function blogSave(){ |
| 31 | + try { | ||
| 31 | if(!empty($this->param['image'])){ | 32 | if(!empty($this->param['image'])){ |
| 32 | $this->param['image'] = str_replace_url($this->param['image']); | 33 | $this->param['image'] = str_replace_url($this->param['image']); |
| 33 | } | 34 | } |
| 34 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 35 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 35 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 36 | - if($rs === false){ | ||
| 37 | - $this->fail('error'); | 36 | + $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 37 | + }catch (\Exception $e){ | ||
| 38 | + $this->fail('保存失败,请联系管理员'); | ||
| 38 | } | 39 | } |
| 39 | return $this->success(); | 40 | return $this->success(); |
| 40 | } | 41 | } |
| @@ -182,4 +182,27 @@ class AiBlogService | @@ -182,4 +182,27 @@ class AiBlogService | ||
| 182 | $result = http_post($request_url,json_encode($param,true)); | 182 | $result = http_post($request_url,json_encode($param,true)); |
| 183 | return $result; | 183 | return $result; |
| 184 | } | 184 | } |
| 185 | + | ||
| 186 | + /** | ||
| 187 | + * @remark :更新文章 | ||
| 188 | + * @name :updateDetail | ||
| 189 | + * @author :lyh | ||
| 190 | + * @method :post | ||
| 191 | + * @time :2025/2/21 14:38 | ||
| 192 | + */ | ||
| 193 | + public function updateDetail($title,$image){ | ||
| 194 | + $request_url = $this->url.'api/result/save'; | ||
| 195 | + $param = [ | ||
| 196 | + 'mch_id'=>$this->mch_id, | ||
| 197 | + 'author_id'=>$this->author_id, | ||
| 198 | + 'route'=>$this->route, | ||
| 199 | + 'author_id'=>$this->author_id, | ||
| 200 | + 'title'=>$title, | ||
| 201 | + 'thumb'=>$image, | ||
| 202 | + ]; | ||
| 203 | + $this->sign = $this->generateSign($param,$this->key); | ||
| 204 | + $param['sign'] = $this->sign; | ||
| 205 | + $result = http_post($request_url,json_encode($param,true)); | ||
| 206 | + return $result; | ||
| 207 | + } | ||
| 185 | } | 208 | } |
-
请 注册 或 登录 后发表评论