From 2c18af0aa7ba326fec95510c9a5cd90fe0b3aaee Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 24 Jun 2020 09:11:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=B6=E6=9E=84=E8=B0=83=E6=95=B4=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/event/LoadModuleRoutes.php | 28 +++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/extend/catcher/event/LoadModuleRoutes.php b/extend/catcher/event/LoadModuleRoutes.php index 42d87b2..047556e 100644 --- a/extend/catcher/event/LoadModuleRoutes.php +++ b/extend/catcher/event/LoadModuleRoutes.php @@ -6,6 +6,7 @@ namespace catcher\event; use catchAdmin\permissions\PermissionsMiddleware; use catchAdmin\user\AuthTokenMiddleware; use catcher\CatchAdmin; +use think\App; use think\Route; class LoadModuleRoutes @@ -19,28 +20,21 @@ class LoadModuleRoutes public function handle(): void { $router = app(Route::class); - $domain = config('catch.domain'); - - $routes = CatchAdmin::getRoutes(); - - $routeMiddleware = config('catch.route_middleware'); - + $paths = app(App::class)->make('routePath')->get(); + // $routeMiddleware = config('catch.route_middleware'); if ($domain) { - $router->domain($domain, function () use ($router, $routes) { - foreach ($routes as $route) { - include $route; + $router->domain($domain, function () use ($router, $paths) { + foreach ($paths as $path) { + include $path; } - })->middleware($routeMiddleware); + }); } else { - $router->group(function () use ($router, $routes) { - foreach ($routes as $route) { - include $route; + $router->group(function () use ($router, $paths) { + foreach ($paths as $path) { + include $path; } - })->middleware($routeMiddleware); + }); } - - // 单独加载登录 - include CatchAdmin::moduleDirectory('login') . 'route.php'; } }