diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 5a0fc0ac3..7902bd098 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -36,13 +36,14 @@ class Index extends Controller */ public function index() { - if ($this->app->isDebug()) { - AdminService::instance()->apply(true); - } else { - AdminService::instance()->apply(false); - } + /*! 根据运行模式刷新权限 */ + $clear = $this->app->isDebug(); + AdminService::instance()->apply($clear); + /*! 读取当前权限菜单树 */ $this->menus = MenuService::instance()->getTree(); + /*! 判断用户是否已经登录 */ $this->login = AdminService::instance()->isLogin(); + /*! 菜单为空并且未登录跳转到登录页 */ if (empty($this->menus) && empty($this->login)) { $this->redirect(sysuri('admin/login/index')); } else { diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index 7bc599b52..fa88f3e9f 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -62,7 +62,7 @@ class Login extends Controller if (!CaptchaService::instance()->check($data['verify'], $data['uniqid'])) { $this->error('图形验证码验证失败,请重新输入!'); } - // 用户信息验证 + /*! 用户信息验证 */ $map = ['username' => $data['username'], 'is_deleted' => '0']; $user = $this->app->db->name('SystemUser')->where($map)->order('id desc')->find(); if (empty($user)) {