|
...
|
...
|
@@ -36,12 +36,6 @@ 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);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -69,11 +63,6 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function serviceConfigSave()
|
|
|
|
{
|
|
|
|
$project = new Project();
|
|
|
|
$project_list = $project->read(['id'=>$this->param['project_id']]);
|
|
|
|
if($project_list === false){
|
|
|
|
$this->fail('项目不存在或者已经删除');
|
|
|
|
}
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
//保存配置
|
|
...
|
...
|
@@ -81,7 +70,7 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
$this->param['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->add($project);
|
|
|
|
$this->model->add($this->param);
|
|
|
|
}
|
|
|
|
//初始化数据库
|
|
|
|
DB::commit();
|
|
...
|
...
|
@@ -92,31 +81,6 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :添加数据
|
|
|
|
* @name :add
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/4 17:17
|
|
|
|
*/
|
|
|
|
public function add(&$project){
|
|
|
|
//查询当前项目是否已设置
|
|
|
|
$info = $this->model->read(['project_id'=>$this->param['project_id'],'type'=>$this->param['type']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前项目已设置'.$this->param['type'] == 1?'服务器':'数据库');
|
|
|
|
}
|
|
|
|
$this->param['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$this->param['updated_at'] = $this->param['created_at'];
|
|
|
|
$res = $this->model->insertGetId($this->param);
|
|
|
|
if ($this->param['type'] == ServerConfig::TYPE_SERVER) {
|
|
|
|
$data['serve_id'] = $res;
|
|
|
|
}else{
|
|
|
|
$data['mysql_id'] = $res;
|
|
|
|
//$this->initializationMysql($this->param);
|
|
|
|
}
|
|
|
|
$project->edit($data,['id'=>$this->param['project_id']]);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :初始化数据库
|
...
|
...
|
|