作者 lyh

gx脚本

@@ -124,12 +124,20 @@ class AiCommandController extends BaseController @@ -124,12 +124,20 @@ class AiCommandController extends BaseController
124 */ 124 */
125 public function sendLayoutDesign(){ 125 public function sendLayoutDesign(){
126 $this->request->validate([ 126 $this->request->validate([
127 - 'ai'=>['required'] 127 + 'key'=>['required'],
  128 + 'html'=>['required']
128 ],[ 129 ],[
129 - 'ai.required' => '场景不能为空', 130 + 'key.required' => '场景不能为空',
  131 + 'html.required' => 'html不能为空',
130 ]); 132 ]);
  133 + $aiCommonModel = new AiCommand();
  134 + $info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']]);
  135 + if($info === false){
  136 + $info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0]);
  137 + }
131 $aiCommandService = new AiCommandService(); 138 $aiCommandService = new AiCommandService();
132 - $result = $aiCommandService->send_layout_design($this->param['ai']); 139 + $ai = str_replace('{html}',$this->param['html'],$info['ai']);
  140 + $result = $aiCommandService->send_layout_design($ai);
133 $this->response('success', Code::SUCCESS, $result); 141 $this->response('success', Code::SUCCESS, $result);
134 } 142 }
135 } 143 }