分离后台和用户中心登录状态
This commit is contained in:
@@ -13,16 +13,29 @@ use think\facade\Session;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
*
|
||||
* @title 检查登录状态
|
||||
*/
|
||||
function is_login() {
|
||||
$user = Session::get('userInfo');
|
||||
return isset($user['uid']) ? $user['uid'] : false;
|
||||
if(strpos(Request::controller(), ".")){
|
||||
list($module, $controller) = explode(".", Request::controller());
|
||||
}else{
|
||||
$module = "";
|
||||
}
|
||||
$user = Session::get(strtolower($module) . 'Info');
|
||||
return $user['uid'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 检查是否为超级管理员
|
||||
*/
|
||||
function is_administrator() {
|
||||
$user = Session::get('userInfo');
|
||||
return (isset($user['uid']) && (int) $user['uid'] === (int) env('rootuid')) ? true : false;
|
||||
if(strpos(Request::controller(), ".")){
|
||||
list($module, $controller) = explode(".", Request::controller());
|
||||
}else{
|
||||
$module = "";
|
||||
}
|
||||
$user = Session::get(strtolower($module) . 'Info');
|
||||
return (int) $user['uid'] === (int) env('rootuid') ? true : false;
|
||||
}
|
||||
|
||||
function form($field = [], $data = []) {
|
||||
|
||||
Reference in New Issue
Block a user