mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 01:52:48 +08:00
refactor: 重构用户信息状态代码写法。
This commit is contained in:
@@ -121,8 +121,8 @@ class AdminControllerBase extends BaseController
|
||||
parent::initialize();
|
||||
$this->layout && $this->app->view->engine()->layout($this->layout);
|
||||
$this->isDemo = Env::get('adminsystem.is_demo', false);
|
||||
$this->viewInit();
|
||||
$this->checkAuth();
|
||||
$this->viewInit();
|
||||
|
||||
$this->initSort();
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class AdminControllerBase extends BaseController
|
||||
$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;
|
||||
$isSuperAdmin = $this->sessionAdmin->id == AdminConstant::SUPER_ADMIN_ID ? true : false;
|
||||
$data = [
|
||||
'adminModuleName' => $adminModuleName,
|
||||
'thisController' => parse_name($thisController),
|
||||
@@ -462,13 +462,7 @@ class AdminControllerBase extends BaseController
|
||||
protected function checkAuth($currentNode = null, $haltRequest = true)
|
||||
{
|
||||
$adminConfig = config('admin');
|
||||
|
||||
$token = $this->readHeaderToken();
|
||||
if (!empty($token)) {
|
||||
$admin = Cache::get($token);
|
||||
} else {
|
||||
$admin = session('admin');
|
||||
}
|
||||
$admin = get_session_admin();
|
||||
|
||||
$back_url = $this->request->url();
|
||||
|
||||
@@ -528,12 +522,7 @@ class AdminControllerBase extends BaseController
|
||||
}
|
||||
|
||||
protected function readHeaderToken(){
|
||||
$header_authorization = $this->request->header('Authorization');
|
||||
if (!empty($header_authorization)) {
|
||||
$token = explode(' ', $header_authorization)[1];
|
||||
return $token;
|
||||
}
|
||||
return null;
|
||||
return read_header_token();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user