This commit is contained in:
root 2020-01-29 16:37:57 +08:00
parent d7063191f4
commit 7cb5eb03b9

View File

@ -21,11 +21,7 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Admin\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\Admin\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
}); });
// User // User
@ -34,19 +30,11 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{action}', function($action) { Route::any('/{action}', function($action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\User\\UserController"); $ctrl = \App::make("\\App\\Http\\Controllers\\User\\UserController");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\User\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\User\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
Route::get('server/log/fetch', 'User\\ServerController@logFetch'); Route::get('server/log/fetch', 'User\\ServerController@logFetch');
}); });
@ -56,11 +44,7 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Passport\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\Passport\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
}); });
// No Auth // No Auth
@ -68,11 +52,7 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Guest\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\Guest\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
}); });
// Client // Client
@ -81,19 +61,11 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{action}', function($action) { Route::any('/{action}', function($action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Client\\ClientController"); $ctrl = \App::make("\\App\\Http\\Controllers\\Client\\ClientController");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Client\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\Client\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
}); });
// Server // Server
@ -101,11 +73,7 @@ Route::prefix('v1')
->group(function () { ->group(function () {
Route::any('/{class}/{action}', function($class, $action) { Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Server\\" . ucfirst($class) . "Controller"); $ctrl = \App::make("\\App\\Http\\Controllers\\Server\\" . ucfirst($class) . "Controller");
try { return \App::call([$ctrl, $action]);
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
}); });
}); });
}); });