/** * 基础身份认证 */ protected function baseAccessAuth() { $auth = HyAuthModel::baseAccessAuth(); if (!$auth['status']) { $this->error($auth['info'], $auth['url'], $auth['time']); } }
/** * 角色信息缓存 * @param number $roleId */ private function roleCache($roleId) { session('roleId', $roleId); $role = array(); $roleSwitch = array(); $tmp = M('frame_role')->where(array('status' => 1, 'id' => array('IN', session('roleIdArr'))))->getField('id,name,title,table'); if (is_array($tmp)) { } foreach ($tmp as $k => $v) { if (!$v) { continue; } if ($k == $roleId) { $role = $v; continue; } $roleSwitch[act_encrypt($k)] = $v['title']; } $roleSwitch[act_encrypt($roleId)] = $role['title']; $roleSwitch = array_reverse($roleSwitch); session('roleSwitch', $roleSwitch); session('roleTitle', $role['title']); // 角色切换后置方法 D('HyAccount')->onRoleSwitch($role); HyAuthModel::cacheAccess($roleId); }