diff --git a/app/admin/config/route.php b/app/admin/config/route.php index f75c439..bfae446 100644 --- a/app/admin/config/route.php +++ b/app/admin/config/route.php @@ -8,12 +8,5 @@ return [ // 路由中间件 'middleware' => [ -// // 后台视图初始化 -// \app\admin\middleware\ViewInit::class, - - // 检测用户是否登录 -// \app\admin\middleware\CheckAdmin::class, - - ], ]; diff --git a/app/admin/middleware.php b/app/admin/middleware.php index 56b6897..bd595d4 100644 --- a/app/admin/middleware.php +++ b/app/admin/middleware.php @@ -11,11 +11,4 @@ return [ // Csrf安全校验 \app\admin\middleware\CsrfMiddleware::class, - // 后台视图初始化 -// \app\admin\middleware\ViewInit::class, - - // 检测用户是否登录 -// \app\admin\middleware\CheckAdmin::class, - - ]; diff --git a/app/admin/middleware/CheckAdmin.php b/app/admin/middleware/CheckAdmin.php deleted file mode 100644 index e6f657d..0000000 --- a/app/admin/middleware/CheckAdmin.php +++ /dev/null @@ -1,58 +0,0 @@ - $adminId]); - $currentNode = $authService->getCurrentNode(); - $currentController = parse_name($request->controller()); - - // 验证登录 - if (!in_array($currentController, $adminConfig['no_login_controller']) && - !in_array($currentNode, $adminConfig['no_login_node'])) { - empty($adminId) && $this->error('请先登录后台', [], __url('admin/login/index')); - - // 判断是否登录过期 - if ($expireTime !== true && time() > $expireTime) { - session('admin', null); - $this->error('登录已过期,请重新登录', [], __url('admin/login/index')); - } - } - - // 验证权限 - if (!in_array($currentController, $adminConfig['no_auth_controller']) && - !in_array($currentNode, $adminConfig['no_auth_node'])) { - $check = $authService->checkNode($currentNode); - !$check && $this->error('无权限访问'); - - // 判断是否为演示环境 - if(env('adminsystem.is_demo', false) && $request->isPost()){ - $this->error('演示环境下不允许修改'); - } - - } - - return $next($request); - } - -} \ No newline at end of file diff --git a/app/admin/middleware/ViewInit.php b/app/admin/middleware/ViewInit.php deleted file mode 100644 index ba9285f..0000000 --- a/app/admin/middleware/ViewInit.php +++ /dev/null @@ -1,49 +0,0 @@ -getName(), Request::controller(), $request->action()]; - list($thisControllerArr, $jsPath) = [explode('.', $thisController), null]; - foreach ($thisControllerArr as $vo) { - empty($jsPath) ? $jsPath = parse_name($vo) : $jsPath .= '/' . parse_name($vo); - } - $autoloadJs = file_exists(root_path('public')."static/{$thisModule}/js/{$jsPath}.js") ? true : false; - $thisControllerJsPath = "{$thisModule}/js/{$jsPath}.js"; - $adminModuleName = config('app.admin_alias_name'); - $isSuperAdmin = session('admin.id') == AdminConstant::SUPER_ADMIN_ID ? true : false; - $data = [ - 'adminModuleName' => $adminModuleName, - 'thisController' => parse_name($thisController), - 'thisAction' => $thisAction, - 'thisRequest' => parse_name("{$thisModule}/{$thisController}/{$thisAction}"), - 'thisControllerJsPath' => "{$thisControllerJsPath}", - 'autoloadJs' => $autoloadJs, - 'isSuperAdmin' => $isSuperAdmin, - 'version' => env('app_debug') ? time() : ConfigService::getVersion(), - ]; - - View::assign($data); - $request->adminModuleName = $adminModuleName; - return $next($request); - } - - -} \ No newline at end of file