作者 lyh

gx脚本

... ... @@ -124,12 +124,20 @@ class AiCommandController extends BaseController
*/
public function sendLayoutDesign(){
$this->request->validate([
'ai'=>['required']
'key'=>['required'],
'html'=>['required']
],[
'ai.required' => '场景不能为空',
'key.required' => '场景不能为空',
'html.required' => 'html不能为空',
]);
$aiCommonModel = new AiCommand();
$info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']]);
if($info === false){
$info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0]);
}
$aiCommandService = new AiCommandService();
$result = $aiCommandService->send_layout_design($this->param['ai']);
$ai = str_replace('{html}',$this->param['html'],$info['ai']);
$result = $aiCommandService->send_layout_design($ai);
$this->response('success', Code::SUCCESS, $result);
}
}
... ...