作者 lyh

gx

... ... @@ -52,6 +52,24 @@ class ServerConfigController extends BaseController
}
/**
* @remark :删除配置
* @name :del
* @author :lyh
* @method :post
* @time :2023/8/2 15:41
*/
public function del(ServerConfigLogic $logic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$logic->delServiceConfig();
return $this->response('success');
}
/**
* 更新表结构
* @param ServerConfigLogic $logic
* @author zbj
... ... @@ -82,26 +100,7 @@ class ServerConfigController extends BaseController
$data = $logic->updateAllTable($this->param);
break;
}
return $this->success($data);
}
/**
* 更新代码
* @param ServerConfigLogic $logic
* @author zbj
* @date 2023/4/24
*/
public function updateCode(){
//todo
//C端
// $process = new Process(['git', 'pull']);
// $process->run();
// dump($process->getExitCodeText());
// dump($process->getExitCode());
// dump($process->getErrorOutput());
// $output = explode(PHP_EOL, $process->getOutput());
// dump($output);
// exit;
}
}
... ...
... ... @@ -24,7 +24,7 @@ class MenuController extends BaseController
public function list(Request $request, MenuLogic $logic)
{
$map = [];
$map = ['type'=>1];
$sort = ['id' => 'desc'];
$list = $logic->getList($map, $sort, ['id', 'pid', 'title', 'icon', 'type', 'menu_path'],0);
return $this->success(Arr::listToTree($list));
... ...
... ... @@ -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();
}
/**
* 更新指定项目 数据库
... ...