|
@@ -81,6 +81,30 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -81,6 +81,30 @@ class ServerConfigLogic extends BaseLogic |
|
81
|
$this->param['updated_at'] = date('Y-m-d H:i:s');
|
81
|
$this->param['updated_at'] = date('Y-m-d H:i:s');
|
|
82
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
82
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
83
|
}else{
|
83
|
}else{
|
|
|
|
84
|
+ $this->add($project);
|
|
|
|
85
|
+ }
|
|
|
|
86
|
+ //初始化数据库
|
|
|
|
87
|
+ DB::commit();
|
|
|
|
88
|
+ } catch (\Exception $e) {
|
|
|
|
89
|
+ DB::rollBack();
|
|
|
|
90
|
+ $this->fail('保存失败');
|
|
|
|
91
|
+ }
|
|
|
|
92
|
+ return $this->success();
|
|
|
|
93
|
+ }
|
|
|
|
94
|
+
|
|
|
|
95
|
+ /**
|
|
|
|
96
|
+ * @remark :添加数据
|
|
|
|
97
|
+ * @name :add
|
|
|
|
98
|
+ * @author :lyh
|
|
|
|
99
|
+ * @method :post
|
|
|
|
100
|
+ * @time :2023/8/4 17:17
|
|
|
|
101
|
+ */
|
|
|
|
102
|
+ public function add(&$project){
|
|
|
|
103
|
+ //查询当前项目是否已设置
|
|
|
|
104
|
+ $info = $this->model->read(['project_id'=>$this->param['project_id'],'type'=>$this->param['type']]);
|
|
|
|
105
|
+ if($info !== false){
|
|
|
|
106
|
+ $this->fail('当前项目已设置'.$this->param['type'] == 1?'服务器':'数据库');
|
|
|
|
107
|
+ }
|
|
84
|
$this->param['created_at'] = date('Y-m-d H:i:s');
|
108
|
$this->param['created_at'] = date('Y-m-d H:i:s');
|
|
85
|
$this->param['updated_at'] = $this->param['created_at'];
|
109
|
$this->param['updated_at'] = $this->param['created_at'];
|
|
86
|
$res = $this->model->insertGetId($this->param);
|
110
|
$res = $this->model->insertGetId($this->param);
|
|
@@ -90,14 +114,7 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -90,14 +114,7 @@ class ServerConfigLogic extends BaseLogic |
|
90
|
$data['mysql_id'] = $res;
|
114
|
$data['mysql_id'] = $res;
|
|
91
|
}
|
115
|
}
|
|
92
|
$project->edit($data,['id'=>$this->param['project_id']]);
|
116
|
$project->edit($data,['id'=>$this->param['project_id']]);
|
|
93
|
- }
|
|
|
|
94
|
- //初始化数据库
|
|
|
|
95
|
- DB::commit();
|
|
|
|
96
|
- } catch (\Exception $e) {
|
|
|
|
97
|
- DB::rollBack();
|
|
|
|
98
|
- $this->fail('保存失败');
|
|
|
|
99
|
- }
|
|
|
|
100
|
- return $this->success();
|
117
|
+ return true;
|
|
101
|
}
|
118
|
}
|
|
102
|
|
119
|
|
|
103
|
/**
|
120
|
/**
|