From 97056be8c389badb2730a27dfdf37e4c1f383c0f Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Tue, 10 Mar 2020 13:45:48 +0800 Subject: [PATCH] opt 1.2.3 --- app/Http/Controllers/Admin/ServerController.php | 15 +++++++++++++++ app/Http/Routes/AdminRoute.php | 1 + 2 files changed, 16 insertions(+) diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index 65456fc6..76d218a7 100755 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -171,4 +171,19 @@ class ServerController extends Controller 'data' => true ]); } + + public function copy(Request $request) + { + $server = Server::find($request->input('id')); + if (!$server) { + abort(500, '服务器不存在'); + } + if (!Server::create($server)) { + abort(500, '复制失败'); + } + + return response([ + 'data' => true + ]); + } } diff --git a/app/Http/Routes/AdminRoute.php b/app/Http/Routes/AdminRoute.php index bab60290..43ac7034 100644 --- a/app/Http/Routes/AdminRoute.php +++ b/app/Http/Routes/AdminRoute.php @@ -27,6 +27,7 @@ class AdminRoute $router->post('/server/group/drop', 'Admin\\ServerController@groupDrop'); $router->post('/server/drop', 'Admin\\ServerController@drop'); $router->post('/server/update', 'Admin\\ServerController@update'); + $router->post('/server/copy', 'Admin\\ServerController@copy'); // Order $router->get ('/order/fetch', 'Admin\\OrderController@fetch'); $router->post('/order/repair', 'Admin\\OrderController@repair');