private function _get_path_info()
{
$c_path_info = (string)$_SERVER['PATH_INFO']; //找出当前的url
$first_char = substr($c_path_info, 0, 1);
if ($first_char !== '/') {
$c_path_info = '/' . $c_path_info;
}
if (!$c_path_info) {
$c_path_info = '/';
}
if ($c_path_info === '/Index/index' || $c_path_info === '/Index' || $c_path_info === '/Index/') {
$c_path_info = '/';
}
if ($c_path_info !== '/') {
$c_path_info_arr = explode('/', $c_path_info);
if (!$c_path_info_arr[2]) {
$c_path_info = rtrim($c_path_info, '/');
$c_path_info .= '/index';
}
}
// 无敌的跳转
if ((int)$_SESSION['_admin_super'] !== 1) {
if ($c_path_info === '/') {
// 判断是否有权限
$role_powers = explode('-', $_SESSION['_admin_power']);
$action = M('action');
$first_action_info = $action->where(['id' => ['in', $role_powers], 'level' => 2])->find();
$c_path_info = $first_action_info['urls'];
if ($c_path_info !== '/') {
$this->redirect($c_path_info);
}
} else {
// 查询
$action = M('action');
$action_info = $action->where(['urls' => $c_path_info, 'level' => 2])->find();
$role_powers = explode('-', $_SESSION['_admin_power']);
if ($action_info && !in_array($action_info['id'], $role_powers, false)) {
$current_action_info = $action->where(['id' => ['in', $role_powers], 'level' => 2, 'pid' => $action_info['pid']])->find();
$c_path_info = $current_action_info['urls'];
if ($c_path_info !== '/') {
$this->redirect($c_path_info);
}
}
}
}
return $c_path_info;
}