diff --git a/Application/Admin/Model/MemberModel.class.php b/Application/Admin/Model/MemberModel.class.php index 67c3675ef..9469f49c3 100644 --- a/Application/Admin/Model/MemberModel.class.php +++ b/Application/Admin/Model/MemberModel.class.php @@ -72,6 +72,7 @@ class MemberModel extends Model { $this->save($data); $adminData = getAdminData($user['uid']); + $groupId = getGameGroup($user['uid']); /* 记录登录SESSION和COOKIES */ $auth = array( @@ -86,6 +87,7 @@ class MemberModel extends Model { $expireTime = 3600; ini_set('session.gc_maxlifetime', $expireTime); ini_set('session.cookie_lifetime', $expireTime); + session('user_group_id',$groupId); session('user_auth', $auth); session('user_auth_sign', data_auth_sign($auth)); session('user_auth_expire', time()); diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index a104b86c1..6fe9fce05 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -32,6 +32,7 @@ function is_login() if (time() - intval(session('user_auth_expire')) > $expire) { // 过期正则直接去除掉session 并且返回false session('user_auth', null); session('user_auth_sign', null); + session('user_group_id', null); return 0; } else { session('user_auth_expire', time() + $expire); @@ -48,7 +49,9 @@ function is_login() function is_administrator($uid = null) { $uid = is_null($uid) ? is_login() : $uid; - return $uid && (intval($uid) === C('USER_ADMINISTRATOR')); + + return $uid && (session('user_group_id') == 1); +// (intval($uid) === C('USER_ADMINISTRATOR')); } /** @@ -1472,4 +1475,12 @@ function getPromoteCompanyName($companyId) function getGameTypes() { return M('game_type', 'tab_')->field('id, type_name')->where(['status' => 1])->select(); +} + +function getGameGroup($uid) { + + $groupId = M('auth_group_access')->field('group_id')->where(['uid'=>$uid])->find(); + + return $groupId['group_id']?$groupId['group_id']:0; + } \ No newline at end of file