From ebe5f5757a654c8293d2c2cb35918b3488f3a038 Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Tue, 18 Feb 2020 14:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=AD=E9=97=B4=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E4=B8=B2=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/CatchAdminService.php | 4 +- extend/catcher/CatchExceptionHandle.php | 122 +++++++++++----------- extend/catcher/event/LoadModuleRoutes.php | 5 +- 3 files changed, 65 insertions(+), 66 deletions(-) diff --git a/catch/CatchAdminService.php b/catch/CatchAdminService.php index 28b5c4b..9d86a0a 100644 --- a/catch/CatchAdminService.php +++ b/catch/CatchAdminService.php @@ -99,9 +99,7 @@ class CatchAdminService extends Service */ protected function registerMiddleWares(): void { - $this->app->middleware->import([ - 'catch_check_permission' => PermissionsMiddleware::class, - ], 'route'); + // todo } /** diff --git a/extend/catcher/CatchExceptionHandle.php b/extend/catcher/CatchExceptionHandle.php index c9f65d2..1feec71 100644 --- a/extend/catcher/CatchExceptionHandle.php +++ b/extend/catcher/CatchExceptionHandle.php @@ -1,61 +1,61 @@ -getMessage()); - } - - return parent::render($request, $e); - } -} \ No newline at end of file +getMessage()); + } + + return parent::render($request, $e); + } +} diff --git a/extend/catcher/event/LoadModuleRoutes.php b/extend/catcher/event/LoadModuleRoutes.php index 9904410..12b8618 100644 --- a/extend/catcher/event/LoadModuleRoutes.php +++ b/extend/catcher/event/LoadModuleRoutes.php @@ -3,6 +3,7 @@ declare (strict_types = 1); namespace catcher\event; +use catchAdmin\permissions\PermissionsMiddleware; use catchAdmin\user\AuthTokenMiddleware; use catcher\CatchAdmin; use think\Route; @@ -28,13 +29,13 @@ class LoadModuleRoutes foreach ($routes as $route) { include $route; } - })->middleware([AuthTokenMiddleware::class]); + })->middleware([AuthTokenMiddleware::class, PermissionsMiddleware::class]); } else { $router->group(function () use ($router, $routes) { foreach ($routes as $route) { include $route; } - })->middleware([AuthTokenMiddleware::class]); + })->middleware([AuthTokenMiddleware::class, PermissionsMiddleware::class]); } // 单独加载登录