IndexController.class.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Admin\Controller;
  3. use Common\Controller\AuthController;
  4. use Think\Auth;
  5. /**
  6. * 普通用户等模块
  7. * 首页
  8. */
  9. class IndexController extends AuthController {
  10. public function __construct() {
  11. $is_jump = true; //是否根据IP跳转城市 默认true
  12. parent::__construct($is_jump);
  13. $auth = session('admin_auth');
  14. if (!$auth) {
  15. //$this->redirect(U('Public/login'));
  16. }
  17. }
  18. /**
  19. * 获取MySQL版本
  20. * @author huangch
  21. */
  22. private function _mysql_version(){
  23. $model = new \Think\Model();
  24. $version = $model->query("select version() as ver");
  25. return $version[0]['ver'];
  26. }
  27. /**
  28. * 我的桌面
  29. * @author: huangch
  30. */
  31. public function panel() {
  32. /*$system_info = array(
  33. 'server_domain' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]',
  34. 'server_os' => PHP_OS,
  35. 'web_server' => $_SERVER["SERVER_SOFTWARE"],
  36. 'php_version' => PHP_VERSION,
  37. 'mysql_version' => $this->_mysql_version(),
  38. 'upload_max_filesize' => ini_get('upload_max_filesize'),
  39. 'max_execution_time' => ini_get('max_execution_time') . '秒',
  40. 'safe_mode' => (boolean) ini_get('safe_mode') ? '是' : '否',
  41. 'zlib' => function_exists('gzclose') ? '是' : '否',
  42. 'curl' => function_exists("curl_getinfo") ? '是' : '否',
  43. 'timezone' => function_exists("date_default_timezone_get") ? date_default_timezone_get() : '否'
  44. );*/
  45. $admin = AuthController::get_my_info();
  46. $mod = M('setting');
  47. $list = $mod->select();
  48. $this->assign('list', $list[0]);
  49. $this->assign('username',$admin['admin_username']);
  50. //$this->assign('system_info', $system_info);
  51. $this->display();
  52. }
  53. public function index() {
  54. $admin = AuthController::get_my_info();
  55. $m = M('auth_rule');
  56. $field = 'id,name,title,sort';
  57. $data = $m->field($field)->where('pid=0 AND status=1 AND type=1')->order('sort desc')->select();
  58. $auth = new Auth();
  59. //没有权限的菜单不显示
  60. foreach ($data as $k=>$v){
  61. $sub_data = $m->where(array('pid'=>$v['id'],'status'=>1,'is_show'=>1,'type'=>1))->order('sort desc')->select();
  62. $data[$k]['sub'] = $sub_data;
  63. foreach ($sub_data as $kk => $vv) {
  64. if(!$auth->check($vv['name'], $admin['aid']) && $admin['aid'] != 1){
  65. unset($data[$k]['sub'][$kk]);
  66. }
  67. }
  68. if(!$auth->check($v['name'], $admin['aid']) && $admin['aid'] != 1){
  69. unset($data[$k]);
  70. }
  71. }
  72. $this->assign('left_menus', $data);
  73. $this->assign('username',$admin['admin_username']);
  74. $this->display();
  75. }
  76. }
  77. ?>