|
...
|
...
|
@@ -81,15 +81,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->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;
|
|
|
|
}
|
|
|
|
$project->edit($data,['id'=>$this->param['project_id']]);
|
|
|
|
$this->add($project);
|
|
|
|
}
|
|
|
|
//初始化数据库
|
|
|
|
DB::commit();
|
|
...
|
...
|
@@ -101,6 +93,31 @@ class ServerConfigLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
}
|
|
|
|
$project->edit($data,['id'=>$this->param['project_id']]);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :初始化数据库
|
|
|
|
* @name :initializationMysql
|
|
|
|
* @author :lyh
|
...
|
...
|
|