12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace Admin\Controller;
- use Common\Controller\AuthController;
- use Think\Auth;
- /**
- * 普通用户等模块
- * 首页
- */
- class IndexController extends AuthController {
- public function __construct() {
- $is_jump = true; //是否根据IP跳转城市 默认true
- parent::__construct($is_jump);
- $auth = session('admin_auth');
- if (!$auth) {
- //$this->redirect(U('Public/login'));
- }
- }
- /**
- * 获取MySQL版本
- * @author huangch
- */
- private function _mysql_version(){
- $model = new \Think\Model();
- $version = $model->query("select version() as ver");
- return $version[0]['ver'];
- }
- /**
- * 我的桌面
- * @author: huangch
- */
- public function panel() {
- /*$system_info = array(
- 'server_domain' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]',
- 'server_os' => PHP_OS,
- 'web_server' => $_SERVER["SERVER_SOFTWARE"],
- 'php_version' => PHP_VERSION,
- 'mysql_version' => $this->_mysql_version(),
- 'upload_max_filesize' => ini_get('upload_max_filesize'),
- 'max_execution_time' => ini_get('max_execution_time') . '秒',
- 'safe_mode' => (boolean) ini_get('safe_mode') ? '是' : '否',
- 'zlib' => function_exists('gzclose') ? '是' : '否',
- 'curl' => function_exists("curl_getinfo") ? '是' : '否',
- 'timezone' => function_exists("date_default_timezone_get") ? date_default_timezone_get() : '否'
- );*/
- $admin = AuthController::get_my_info();
- $mod = M('setting');
- $list = $mod->select();
- $this->assign('list', $list[0]);
- $this->assign('username',$admin['admin_username']);
- //$this->assign('system_info', $system_info);
- $this->display();
- }
- public function index() {
- $admin = AuthController::get_my_info();
- $m = M('auth_rule');
- $field = 'id,name,title,sort';
- $data = $m->field($field)->where('pid=0 AND status=1 AND type=1')->order('sort desc')->select();
- $auth = new Auth();
- //没有权限的菜单不显示
- foreach ($data as $k=>$v){
- $sub_data = $m->where(array('pid'=>$v['id'],'status'=>1,'is_show'=>1,'type'=>1))->order('sort desc')->select();
- $data[$k]['sub'] = $sub_data;
- foreach ($sub_data as $kk => $vv) {
- if(!$auth->check($vv['name'], $admin['aid']) && $admin['aid'] != 1){
- unset($data[$k]['sub'][$kk]);
- }
- }
- if(!$auth->check($v['name'], $admin['aid']) && $admin['aid'] != 1){
- unset($data[$k]);
- }
- }
- $this->assign('left_menus', $data);
- $this->assign('username',$admin['admin_username']);
- $this->display();
- }
- }
- ?>
|