From d861397e3930c95bd1acacea247defb552c4e873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9APD?= <13558507+yao-shipeng@user.noreply.gitee.com> Date: Wed, 7 Aug 2024 03:50:42 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20serve/ap?= =?UTF-8?q?p/controller/Deploy.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- serve/app/controller/Deploy.php | 93 --------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 serve/app/controller/Deploy.php diff --git a/serve/app/controller/Deploy.php b/serve/app/controller/Deploy.php deleted file mode 100644 index 86b4bd3..0000000 --- a/serve/app/controller/Deploy.php +++ /dev/null @@ -1,93 +0,0 @@ -count();//获取总条数 - $info = Deploys::with(['frameData'])->where($sql)->page($input['page'],$input['limit'])->order(['id'=>'desc'])->select();//查询分页数据 - $result=[ - 'state'=>'success', - 'count'=>$count, - 'info'=>$info - ];//返回数据 - return json($result); - } - //新增|更新 - public function save(){ - $input=input('post.'); - if(isset($input['id'])){ - //验证数据 - try { - empty($input['id'])?$this->validate($input,'app\validate\Deploy'):$this->validate($input,'app\validate\Deploy.update'); - } catch (ValidateException $e) { - return json(['state'=>'error','info'=>$e->getError()]); - exit; - } - - //处理数据 - Db::startTrans(); - try { - if(empty($input['id'])){ - //创建数据 - Deploys::create($input); - pushLog('新增零售配置');//日志 - }else{ - //更新数据 - Deploys::update($input); - pushLog('更新零售配置');//日志 - } - - Db::commit(); - $result=['state'=>'success']; - } catch (\Exception $e) { - Db::rollback(); - $result=['state'=>'error','info'=>'内部错误,操作已撤销!']; - } - }else{ - $result=['state'=>'error','info'=>'传入参数不完整!']; - } - return json($result); - } - //获取 - public function get(){ - $input=input('post.'); - if(existFull($input,['id'])){ - $result=[ - 'state'=>'success', - 'info'=>Deploys::where([['id','=',$input['id']]])->find() - ]; - }else{ - $result=['state'=>'error','info'=>'传入参数不完整!']; - } - return json($result); - } - //删除 - public function del(){ - $input=input('post.'); - if(existFull($input,['id'])){ - Db::startTrans(); - try { - Db::name('deploy')->where([['id','=',$input['id']]])->delete(); - pushLog('删除零售配置');//日志 - - Db::commit(); - $result=['state'=>'success']; - } catch (\Exception $e) { - Db::rollback(); - $result=['state'=>'error','info'=>'内部错误,操作已撤销!']; - } - }else{ - $result=['state'=>'error','info'=>'传入参数不完整!']; - } - return json($result); - } -} \ No newline at end of file