|
...
|
...
|
@@ -36,6 +36,12 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
|
|
|
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
|
|
|
if(!empty($lists['list'])){
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
$v['project_title'] = (new Project())->read(['id'=>$v['project_id']])['title'];
|
|
|
|
$lists['list'][$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($lists);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -59,7 +65,6 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
$data['mysql_id'] = $res['id'];
|
|
|
|
}
|
|
|
|
$project_logic->save($data);
|
|
|
|
|
|
|
|
//初始化数据库
|
|
|
|
if ($param['type'] == ServerConfig::TYPE_MYSQL) {
|
|
|
|
//切换数据库配置
|
|
...
|
...
|
@@ -69,7 +74,6 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
//创建表
|
|
|
|
ProjectServer::initTable($project);
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -79,6 +83,29 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除记录
|
|
|
|
* @name :delServiceConfig
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/2 15:43
|
|
|
|
*/
|
|
|
|
public function delServiceConfig(){
|
|
|
|
$info = $this->model->read(['id'=>$this->requestAll['id']]);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前数据不存在或已被删除');
|
|
|
|
}
|
|
|
|
$rs = $this->model->del(['id'=>$this->requestAll['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('删除失败');
|
|
|
|
}
|
|
|
|
//TODO::上线放开
|
|
|
|
// if($info['type'] == $this->model::TYPE_MYSQL){
|
|
|
|
// $sql = 'DROP DATABASE '.$info['title'];
|
|
|
|
// DB::connection('custom_mysql')->statement($sql);
|
|
|
|
// }
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 更新指定项目 数据库
|
...
|
...
|
|