|
@@ -36,6 +36,12 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -36,6 +36,12 @@ class ServerConfigLogic extends BaseLogic |
|
36
|
*/
|
36
|
*/
|
|
37
|
public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
|
37
|
public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
|
|
38
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
38
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
|
|
|
39
|
+ if(!empty($lists['list'])){
|
|
|
|
40
|
+ foreach ($lists['list'] as $k => $v){
|
|
|
|
41
|
+ $v['project_title'] = (new Project())->read(['id'=>$v['project_id']])['title'];
|
|
|
|
42
|
+ $lists['list'][$k] = $v;
|
|
|
|
43
|
+ }
|
|
|
|
44
|
+ }
|
|
39
|
return $this->success($lists);
|
45
|
return $this->success($lists);
|
|
40
|
}
|
46
|
}
|
|
41
|
|
47
|
|
|
@@ -59,7 +65,6 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -59,7 +65,6 @@ class ServerConfigLogic extends BaseLogic |
|
59
|
$data['mysql_id'] = $res['id'];
|
65
|
$data['mysql_id'] = $res['id'];
|
|
60
|
}
|
66
|
}
|
|
61
|
$project_logic->save($data);
|
67
|
$project_logic->save($data);
|
|
62
|
-
|
|
|
|
63
|
//初始化数据库
|
68
|
//初始化数据库
|
|
64
|
if ($param['type'] == ServerConfig::TYPE_MYSQL) {
|
69
|
if ($param['type'] == ServerConfig::TYPE_MYSQL) {
|
|
65
|
//切换数据库配置
|
70
|
//切换数据库配置
|
|
@@ -69,7 +74,6 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -69,7 +74,6 @@ class ServerConfigLogic extends BaseLogic |
|
69
|
//创建表
|
74
|
//创建表
|
|
70
|
ProjectServer::initTable($project);
|
75
|
ProjectServer::initTable($project);
|
|
71
|
}
|
76
|
}
|
|
72
|
-
|
|
|
|
73
|
DB::commit();
|
77
|
DB::commit();
|
|
74
|
} catch (\Exception $e) {
|
78
|
} catch (\Exception $e) {
|
|
75
|
DB::rollBack();
|
79
|
DB::rollBack();
|
|
@@ -79,6 +83,29 @@ class ServerConfigLogic extends BaseLogic |
|
@@ -79,6 +83,29 @@ class ServerConfigLogic extends BaseLogic |
|
79
|
return $this->success();
|
83
|
return $this->success();
|
|
80
|
}
|
84
|
}
|
|
81
|
|
85
|
|
|
|
|
86
|
+ /**
|
|
|
|
87
|
+ * @remark :删除记录
|
|
|
|
88
|
+ * @name :delServiceConfig
|
|
|
|
89
|
+ * @author :lyh
|
|
|
|
90
|
+ * @method :post
|
|
|
|
91
|
+ * @time :2023/8/2 15:43
|
|
|
|
92
|
+ */
|
|
|
|
93
|
+ public function delServiceConfig(){
|
|
|
|
94
|
+ $info = $this->model->read(['id'=>$this->requestAll['id']]);
|
|
|
|
95
|
+ if($info === false){
|
|
|
|
96
|
+ $this->fail('当前数据不存在或已被删除');
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+ $rs = $this->model->del(['id'=>$this->requestAll['id']]);
|
|
|
|
99
|
+ if($rs === false){
|
|
|
|
100
|
+ $this->fail('删除失败');
|
|
|
|
101
|
+ }
|
|
|
|
102
|
+ //TODO::上线放开
|
|
|
|
103
|
+// if($info['type'] == $this->model::TYPE_MYSQL){
|
|
|
|
104
|
+// $sql = 'DROP DATABASE '.$info['title'];
|
|
|
|
105
|
+// DB::connection('custom_mysql')->statement($sql);
|
|
|
|
106
|
+// }
|
|
|
|
107
|
+ return $this->success();
|
|
|
|
108
|
+ }
|
|
82
|
|
109
|
|
|
83
|
/**
|
110
|
/**
|
|
84
|
* 更新指定项目 数据库
|
111
|
* 更新指定项目 数据库
|