public static function reload() { $current_user_info = self::getSessionInfo(); $user_info = User::getUserById($current_user_info['user_id']); if ($user_info['status'] != 1) { Common::jumpUrl("login.php"); return; } //读取该用户所属用户组将该组的权限保存在$_SESSION中 $user_group = UserGroup::getGroupById($user_info['user_group']); $user_info['group_id'] = $user_group['group_id']; $user_info['user_role'] = $user_group['group_role']; $user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']); $menu = MenuUrl::getMenuByUrl('/admin/setting.php'); if (strpos($user_group['group_role'], $menu['menu_id'])) { $user_info['setting'] = 1; } $user_info['login_time'] = Common::getDateTime($user_info['login_time']); UserSession::setSessionInfo($user_info); }
public static function loginDoSomething($user_id) { $user_info = User::getUserById($user_id); if ($user_info['status'] != 1) { Common::jumpUrl("login.php"); return; } //读取该用户所属用户组将该组的权限保存在$_SESSION中 $user_group = UserGroup::getGroupById($user_info['user_group']); $user_info['group_id'] = $user_group['group_id']; $user_info['user_role'] = $user_group['group_role']; $user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']); $menu = MenuUrl::getMenuByUrl('/admin/setting.php'); if (strpos($user_group['group_role'], $menu['menu_id'])) { $user_info['setting'] = 1; } $login_time = time(); $login_ip = Common::getIp(); $update_data = array('login_ip' => $login_ip, 'login_time' => $login_time); User::updateUser($user_info['user_id'], $update_data); $user_info['login_ip'] = $login_ip; $user_info['login_time'] = Common::getDateTime($login_time); UserSession::setSessionInfo($user_info); }