正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
| @@ -80,9 +80,9 @@ class AiCommandController extends BaseController | @@ -80,9 +80,9 @@ class AiCommandController extends BaseController | ||
| 80 | */ | 80 | */ |
| 81 | public function getLayoutDesignInfo(){ | 81 | public function getLayoutDesignInfo(){ |
| 82 | $aiCommonModel = new AiCommand(); | 82 | $aiCommonModel = new AiCommand(); |
| 83 | - $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']]); | 83 | + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']],['key','ai']); |
| 84 | if($data === false){ | 84 | if($data === false){ |
| 85 | - $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0]); | 85 | + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0],['key','ai']); |
| 86 | } | 86 | } |
| 87 | $this->response('success', Code::SUCCESS, $data); | 87 | $this->response('success', Code::SUCCESS, $data); |
| 88 | } | 88 | } |
| @@ -96,21 +96,23 @@ class AiCommandController extends BaseController | @@ -96,21 +96,23 @@ class AiCommandController extends BaseController | ||
| 96 | */ | 96 | */ |
| 97 | public function saveLayoutDesign(){ | 97 | public function saveLayoutDesign(){ |
| 98 | $this->request->validate([ | 98 | $this->request->validate([ |
| 99 | - 'key'=>['required'] | 99 | + 'ai'=>['required'], |
| 100 | ],[ | 100 | ],[ |
| 101 | - 'key.required' => '场景不能为空', | 101 | + 'ai.required' => '指令不能为空', |
| 102 | ]); | 102 | ]); |
| 103 | $aiCommonModel = new AiCommand(); | 103 | $aiCommonModel = new AiCommand(); |
| 104 | if($this->param['key'] != 'ai_layout_design'){ | 104 | if($this->param['key'] != 'ai_layout_design'){ |
| 105 | - $this->response('success'); | 105 | + $this->response('非法key',Code::USER_ERROR); |
| 106 | } | 106 | } |
| 107 | - $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']]); | 107 | + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']],['id']); |
| 108 | if($data === false) { | 108 | if($data === false) { |
| 109 | - $this->param['project_id'] = $this->user['project_id']; | ||
| 110 | - $id = $aiCommonModel->addReturnId($this->param); | 109 | + $param = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0],['name','key']); |
| 110 | + $param['project_id'] = $this->user['project_id']; | ||
| 111 | + $param['ai'] = $this->param['ai']; | ||
| 112 | + $id = $aiCommonModel->addReturnId($param); | ||
| 111 | }else{ | 113 | }else{ |
| 112 | $id = $data['id']; | 114 | $id = $data['id']; |
| 113 | - $aiCommonModel->edit($this->param,['id'=>$data['id']]); | 115 | + $aiCommonModel->edit(['ai'=>$this->param['ai']],['id'=>$data['id']]); |
| 114 | } | 116 | } |
| 115 | $this->response('success', Code::SUCCESS, ['id'=>$id]); | 117 | $this->response('success', Code::SUCCESS, ['id'=>$id]); |
| 116 | } | 118 | } |
| @@ -124,10 +126,8 @@ class AiCommandController extends BaseController | @@ -124,10 +126,8 @@ class AiCommandController extends BaseController | ||
| 124 | */ | 126 | */ |
| 125 | public function sendLayoutDesign(){ | 127 | public function sendLayoutDesign(){ |
| 126 | $this->request->validate([ | 128 | $this->request->validate([ |
| 127 | - 'key'=>['required'], | ||
| 128 | 'html'=>['required'] | 129 | 'html'=>['required'] |
| 129 | ],[ | 130 | ],[ |
| 130 | - 'key.required' => '场景不能为空', | ||
| 131 | 'html.required' => 'html不能为空', | 131 | 'html.required' => 'html不能为空', |
| 132 | ]); | 132 | ]); |
| 133 | $aiCommonModel = new AiCommand(); | 133 | $aiCommonModel = new AiCommand(); |
-
请 注册 或 登录 后发表评论