正在显示
1 个修改的文件
包含
10 行增加
和
10 行删除
| @@ -75,14 +75,14 @@ class ServerConfigLogic extends BaseLogic | @@ -75,14 +75,14 @@ class ServerConfigLogic extends BaseLogic | ||
| 75 | if($project_list === false){ | 75 | if($project_list === false){ |
| 76 | $this->fail('项目不存在或者已经删除'); | 76 | $this->fail('项目不存在或者已经删除'); |
| 77 | } | 77 | } |
| 78 | -// DB::beginTransaction(); | ||
| 79 | -// try { | 78 | + DB::beginTransaction(); |
| 79 | + try { | ||
| 80 | //保存配置 | 80 | //保存配置 |
| 81 | - $res = $this->model->save($this->param); | 81 | + $res = $this->model->insertGetId($this->param); |
| 82 | if ($this->param['type'] == ServerConfig::TYPE_SERVER) { | 82 | if ($this->param['type'] == ServerConfig::TYPE_SERVER) { |
| 83 | - $data['serve_id'] = $res['id']; | 83 | + $data['serve_id'] = $res; |
| 84 | }else{ | 84 | }else{ |
| 85 | - $data['mysql_id'] = $res['id']; | 85 | + $data['mysql_id'] = $res; |
| 86 | } | 86 | } |
| 87 | $project->edit($data,['id'=>$this->param['project_id']]); | 87 | $project->edit($data,['id'=>$this->param['project_id']]); |
| 88 | //初始化数据库 | 88 | //初始化数据库 |
| @@ -94,11 +94,11 @@ class ServerConfigLogic extends BaseLogic | @@ -94,11 +94,11 @@ class ServerConfigLogic extends BaseLogic | ||
| 94 | // //创建表 | 94 | // //创建表 |
| 95 | // ProjectServer::initTable($project); | 95 | // ProjectServer::initTable($project); |
| 96 | // } | 96 | // } |
| 97 | -// DB::commit(); | ||
| 98 | -// } catch (\Exception $e) { | ||
| 99 | -// DB::rollBack(); | ||
| 100 | -// $this->fail('保存失败'); | ||
| 101 | -// } | 97 | + DB::commit(); |
| 98 | + } catch (\Exception $e) { | ||
| 99 | + DB::rollBack(); | ||
| 100 | + $this->fail('保存失败'); | ||
| 101 | + } | ||
| 102 | return $this->success(); | 102 | return $this->success(); |
| 103 | } | 103 | } |
| 104 | 104 |
-
请 注册 或 登录 后发表评论