作者 lyh

gx

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Controllers\Aside\Devops; 3 namespace App\Http\Controllers\Aside\Devops;
4 4
  5 +use App\Enums\Common\Code;
5 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
6 7
7 use App\Http\Logic\Aside\Devops\ServerConfigLogic; 8 use App\Http\Logic\Aside\Devops\ServerConfigLogic;
@@ -21,6 +22,24 @@ class ServerConfigController extends BaseController @@ -21,6 +22,24 @@ class ServerConfigController extends BaseController
21 { 22 {
22 23
23 /** 24 /**
  25 + * @remark :服务器列表
  26 + * @name :lists
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/8/2 14:48
  30 + */
  31 + public function lists(ServerConfigLogic $logic){
  32 + if(isset($this->map['title']) && !empty($this->map['title'])){
  33 + $this->map['title'] = ['like','%'.$this->map['title'],'%'];
  34 + }
  35 + if(isset($this->map['host']) && !empty($this->map['host'])){
  36 + $this->map['host'] = ['like','%'.$this->map['host'],'%'];
  37 + }
  38 + $lists = $logic->serviceConfigList($this->map,$this->page,$this->row,$this->order);
  39 + $this->response('success',Code::SUCCESS,$lists);
  40 + }
  41 +
  42 + /**
24 * 保存配置 43 * 保存配置
25 * @param ServerConfigRequest $request 44 * @param ServerConfigRequest $request
26 * @param ServerConfigLogic $logic 45 * @param ServerConfigLogic $logic
1 -<?php  
2 -  
3 -namespace App\Http\Controllers\Aside\Devops;  
4 -  
5 -use App\Enums\Common\Code;  
6 -use App\Exceptions\AsideGlobalException;  
7 -use App\Exceptions\BsideGlobalException;  
8 -use App\Http\Controllers\Aside\BaseController;  
9 -use App\Http\Logic\Aside\Devops\ServerInformationLogic;  
10 -use App\Http\Requests\Aside\Devops\ServerInformationRequest;  
11 -use App\Models\Devops\ServerInformation;  
12 -use App\Models\Devops\ServerInformationLog;  
13 -use Illuminate\Http\JsonResponse;  
14 -use Illuminate\Http\Request;  
15 -use Psr\Container\ContainerExceptionInterface;  
16 -use Psr\Container\NotFoundExceptionInterface;  
17 -  
18 -class ServerInformationController extends BaseController  
19 -{  
20 - /**  
21 - * @remark :获取服务器列表  
22 - * @name :lists  
23 - * @author :lyh  
24 - * @method :post  
25 - * @time :2023/8/1 11:19  
26 - */  
27 - public function lists()  
28 - {  
29 - if(isset($this->map['title']) && !empty($this->map['title'])){  
30 - $this->map['title'] = ['like','%'.$this->map['title'],'%'];  
31 - }  
32 - $serverInformationModel = new ServerInformation();  
33 - $lists = $serverInformationModel->lists($this->map,$this->page,$this->row,$this->order);  
34 - $this->response('success', Code::SUCCESS, $lists);  
35 -  
36 - }  
37 -  
38 - /**  
39 - * 添加  
40 - * @param ServerInformationRequest $serverInformationRequest  
41 - * @param ServerInformationLogic $serverInformationLogic  
42 - * @return void  
43 - * @throws AsideGlobalException  
44 - * @throws BsideGlobalException  
45 - */  
46 - public function add(ServerInformationRequest $serverInformationRequest, ServerInformationLogic $serverInformationLogic)  
47 - {  
48 -  
49 - $serverInformationRequest->validated();  
50 - $serverInformationLogic->create();  
51 - $this->response('服务器添加成功!');  
52 - }  
53 -  
54 - /**  
55 - * 编辑  
56 - * @param ServerInformationRequest $serverInformationRequest  
57 - * @param ServerInformationLogic $serverInformationLogic  
58 - * @return void  
59 - * @throws AsideGlobalException  
60 - * @throws BsideGlobalException  
61 - */  
62 - public function edit(ServerInformationRequest $serverInformationRequest, ServerInformationLogic $serverInformationLogic)  
63 - {  
64 -  
65 - $serverInformationRequest->validate([  
66 - 'id' => 'required|integer',  
67 - ], [  
68 - 'id.required' => 'ID不能为空',  
69 - 'id.integer' => 'ID必须为整数',  
70 - ]);  
71 - $serverInformationLogic->update();  
72 - $this->response('服务器修改成功!');  
73 - }  
74 -  
75 - /**  
76 - * 删除  
77 - * @param ServerInformationLogic $serverInformationLogic  
78 - * @return void  
79 - * @throws AsideGlobalException  
80 - * @throws BsideGlobalException  
81 - */  
82 - public function delete(ServerInformationLogic $serverInformationLogic)  
83 - {  
84 - $serverInformationLogic->get_batch_update();  
85 - $this->response('服务器删除成功!');  
86 - }  
87 -  
88 -  
89 - /**  
90 - * 恢复数据  
91 - * @param ServerInformationLogic $serverInformationLogic  
92 - * @return void  
93 - * @throws AsideGlobalException  
94 - * @throws BsideGlobalException  
95 - */  
96 - public function restore(ServerInformationLogic $serverInformationLogic)  
97 - {  
98 - $serverInformationLogic->get_batch_update(ServerInformationLog::ACTION_RECOVER, ServerInformation::DELETED_DELETE);  
99 - $this->response('服务器恢复成功!');  
100 - }  
101 -  
102 -  
103 -  
104 - /**  
105 - * 服务器信息  
106 - * @param int $deleted  
107 - * @return JsonResponse  
108 - * @throws AsideGlobalException  
109 - * @throws BsideGlobalException  
110 - * @throws ContainerExceptionInterface  
111 - * @throws NotFoundExceptionInterface  
112 - */  
113 - public function getServerInfo(int $deleted = ServerInformation::DELETED_NORMAL)  
114 - {  
115 - $serverInformationLogic = new ServerInformationLogic();  
116 - $data = $serverInformationLogic->serverInfo($deleted);  
117 - if (!$data) {  
118 - return $this->response('服务器信息不存在', Code::USER_ERROR);  
119 - }  
120 - return $this->success($data->toArray());  
121 - }  
122 -  
123 - /**  
124 - * 获取软删除的服务器信息  
125 - * @return JsonResponse  
126 - * @throws AsideGlobalException  
127 - * @throws BsideGlobalException  
128 - * @throws ContainerExceptionInterface  
129 - * @throws NotFoundExceptionInterface  
130 - */  
131 - public function getDeleteServerInfo()  
132 - {  
133 - return $this->getServerInfo(ServerInformation::DELETED_DELETE);  
134 - }  
135 -  
136 -  
137 -}  
1 -<?php  
2 -  
3 -namespace App\Http\Controllers\Aside\Devops;  
4 -  
5 -use App\Enums\Common\Code;  
6 -use App\Http\Controllers\Aside\BaseController;  
7 -use App\Models\Devops\ServerInformationLog;  
8 -use Illuminate\Http\Request;  
9 -  
10 -class ServerInformationLogController extends BaseController  
11 -{  
12 - public function lists(Request $request)  
13 - {  
14 - $size = $request->input('size', $this->row);  
15 - $data = ServerInformationLog::query()  
16 - ->orderBy('id', 'desc')  
17 - ->paginate($size);  
18 - return $this->response('success', Code::SUCCESS, $data);  
19 -  
20 - }  
21 -}  
@@ -23,10 +23,21 @@ class ServerConfigLogic extends BaseLogic @@ -23,10 +23,21 @@ class ServerConfigLogic extends BaseLogic
23 public function __construct() 23 public function __construct()
24 { 24 {
25 parent::__construct(); 25 parent::__construct();
26 - 26 + $this->param = $this->requestAll;
27 $this->model = new ServerConfig(); 27 $this->model = new ServerConfig();
28 } 28 }
29 29
  30 + /**
  31 + * @remark :获取域名列表
  32 + * @name :serviceConfigList
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2023/8/2 14:51
  36 + */
  37 + public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
  38 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  39 + return $this->success($lists);
  40 + }
30 41
31 public function save($param) 42 public function save($param)
32 { 43 {
@@ -149,29 +149,15 @@ Route::middleware(['aloginauth'])->group(function () { @@ -149,29 +149,15 @@ Route::middleware(['aloginauth'])->group(function () {
149 Route::post('/status', [Aside\Task\TaskController::class, 'status'])->name('admin.task_status'); 149 Route::post('/status', [Aside\Task\TaskController::class, 'status'])->name('admin.task_status');
150 Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow'); 150 Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow');
151 }); 151 });
152 -  
153 - //运维  
154 - Route::prefix('devops')->group(function () {  
155 - //服务器配置  
156 - Route::prefix('server_config')->group(function () {  
157 - Route::post('/save', [Aside\Devops\ServerConfigController::class, 'save'])->name('admin.devops.server_config.save');  
158 - Route::post('/update_database', [Aside\Devops\ServerConfigController::class, 'updateDatabase'])->name('admin.devops.server_config.update_database');  
159 - Route::post('/update_code', [Aside\Devops\ServerConfigController::class, 'updateCode'])->name('admin.devops.server_config.update_code');  
160 - });  
161 -  
162 - // 服务器添加|修改|删除  
163 - Route::prefix('server')->group(function () {  
164 - Route::get('/', [Aside\Devops\ServerInformationController::class, 'lists'])->name('admin.devops.bt'); // 列表 | 搜索  
165 - Route::get('/info', [Aside\Devops\ServerInformationController::class, 'getServerInfo'])->name('admin.devops.bt_info'); // 获取信息  
166 - Route::get('/delete_info', [Aside\Devops\ServerInformationController::class, 'getDeleteServerInfo'])->name('admin.devops.bt_delete_info'); // 删除信息  
167 - Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加  
168 - Route::post('/edit', [Aside\Devops\ServerInformationController::class, 'edit'])->name('admin.devops.bt_edit'); // 修改  
169 - Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除  
170 - Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据  
171 - Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表  
172 - }); 152 + //服务器配置
  153 + Route::prefix('server_config')->group(function () {
  154 + Route::post('/', [Aside\Devops\ServerConfigController::class, 'lists'])->name('admin.server_config.lists');
  155 + Route::post('/save', [Aside\Devops\ServerConfigController::class, 'save'])->name('admin.server_config.save');
  156 + Route::post('/update_database', [Aside\Devops\ServerConfigController::class, 'updateDatabase'])->name('admin.server_config.update_database');
  157 + Route::post('/update_code', [Aside\Devops\ServerConfigController::class, 'updateCode'])->name('admin..server_config.update_code');
173 }); 158 });
174 159
  160 +
175 // 域名管理 161 // 域名管理
176 Route::prefix('domain')->group(function () { 162 Route::prefix('domain')->group(function () {
177 Route::any('/', [Aside\Domain\DomainInfoController::class, 'lists'])->name('admin.domain'); // 列表 | 搜索 163 Route::any('/', [Aside\Domain\DomainInfoController::class, 'lists'])->name('admin.domain'); // 列表 | 搜索