IndexController.class.php.bak.20200601 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. class IndexController extends Controller {
  5. public function _initialize(){
  6. $dat['address'] = convertip_full('114.95.160.191');
  7. if(!session('zt_uid')){
  8. redirect(U('Public/login'));
  9. }
  10. }
  11. public function index(){//加载菜单,主页
  12. $Uid=session('zt_uid');
  13. $Ids = array();//保存用户所属用户组设置的所有权限规则id
  14. if(!in_array($Uid,C('ADMINISTRATOR'))){
  15. $UserAccess = M('auth_group_access');
  16. $Map['uid'] = $Uid;
  17. $Map['`status`']=1;
  18. $DataList = $UserAccess->join('sp_auth_group on group_id=id')->where($Map)->field("rules")->select();
  19. echo $UserAccess->getLastSql();
  20. print_r($DataList);
  21. // s_print($DataList);
  22. foreach ($DataList as $g) {
  23. $Ids = array_merge($Ids, explode(',', trim($g['rules'], ',')));
  24. }
  25. $Ids = array_unique($Ids);
  26. }else{
  27. $Ids="ADMINISTRATOR";
  28. }
  29. if(empty($Ids)){
  30. exit('很抱歉,您没有任何权限!请联系管理员!');
  31. }
  32. if(IS_POST){
  33. $do=I('post.dosubmit','');
  34. if ($do){
  35. $sql="select * from sp_movewater where time>=DATE_SUB(NOW(),INTERVAL 1 MINUTE)";
  36. $res = M()->query($sql);
  37. if($res){
  38. $data['status']=1;
  39. $data['info']=$res;
  40. }else{
  41. $data['status']=0;
  42. }
  43. echo json_encode($data);exit;
  44. }
  45. }
  46. //$AgentSatusCfg=M('v_status_cfg')->select();
  47. //$this->assign('AgentSatusCfg',$AgentSatusCfg);
  48. $this->assign('Username',session('zt_username'));
  49. $this->assign('menulistlv1',$this->menu(1,$Ids));
  50. $this->assign('menulistlv2',$this->menu(2,$Ids));
  51. $this->assign('menulistlv3',$this->menu(3,$Ids));
  52. $ResData=GetUser();
  53. $Extension=session('zt_extension');
  54. $this->assign('cubeDn',$Extension);
  55. $this->assign('bian',$ResData['bian']);
  56. $this->assign('cubeId',$ResData['agentid']);
  57. $this->assign('uid',session('zt_username'));
  58. $this->assign('pad',session('zt_password'));
  59. $this->display();
  60. }
  61. public function menu($part1,$part2){
  62. if($part2==="ADMINISTRATOR"){
  63. $Map=array('status'=>1,'system_type'=>1,'types'=>1,'level'=> $part1);
  64. }
  65. else{
  66. $Map=array('id'=>array('in',$part2),'status'=>1,'system_type'=>1,'types'=>1,'level'=> $part1);
  67. }
  68. $Rules = M('auth_rule')->where($Map)->field('id,pid,level as lv,name as pageurl,title as menuname,(SELECT COUNT(ID) FROM sp_auth_rule b WHERE b.pid= sp_auth_rule.ID AND b.types=1 ) as clicn')->select();
  69. return $Rules ;
  70. }
  71. public function home(){
  72. $Data=I();
  73. if(IS_POST){
  74. $Data['id']=session('zt_uid');
  75. M('user')->data($Data)->save();
  76. exit(json_encode(array('statusCode'=>200,'message'=>'保存成功')));
  77. }
  78. $ResData= M('user')->getByUsername(session('zt_username'));
  79. $this->assign('bian',$ResData['bian']);
  80. $this->display('Index/tablemb');
  81. }
  82. public function CharData(){
  83. $list=array();
  84. //$list['title']=array('text'=>"某楼盘销售情况",'subtext'=>"纯属虚构");
  85. $list['tooltip']=array('trigger'=>"axis");// axisPointer:{type: 'none'}
  86. $list['legend']=array('data'=> array("男","女","aaa"));
  87. $list['toolbox']=array('show'=> true,'feature'=> array(
  88. 'mark'=> array('show'=> true),
  89. 'dataView'=> array('show'=> true,'readOnly'=> false),
  90. 'magicType'=> array('show'=> true,'type'=> array("line","bar",'stack', 'tiled')),//add
  91. 'restore'=> array('show'=> true),
  92. 'saveAsImage'=> array('show'=> true)
  93. ));
  94. $list['dataZoom']= array('show'=> true,'zoomlock'=>true,'realtime'=> true, 'start'=> 12, 'end'=> 98);
  95. $list['calculable']=true;
  96. $list['animation']=false;
  97. $list['xAxis']=array(
  98. array('type'=>"category",
  99. 'boundaryGap'=> false,//add
  100. 'data'=> array("1月",
  101. "2月",
  102. "3月",
  103. "4月",
  104. "5月",
  105. "6月",
  106. "7月",
  107. "8月",
  108. "9月",
  109. "10月",
  110. "11月",
  111. "12月"))
  112. );
  113. $list['yAxis']=array(array('type'=>'value'));//,'splitArea'=> array('show'=> true)
  114. $list['series']=array(
  115. array('name'=>'男','type'=>'line',
  116. 'smooth'=> true,
  117. //'symbol'=>'circle',
  118. //'symbolSize'=> 5,
  119. 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(137, 189, 27, 0.3)",'type'=>'default'))),
  120. 'data'=> array(10, 12, 21, 54, 15, 5, 8, 21, 54, 15, 5, 8)),
  121. /*array('name'=>'女','type'=>'line',
  122. 'smooth'=> true,
  123. 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(0, 136, 212, 0.3)",'type'=>'default'))),
  124. 'data'=> array(5, 3, 8, 87, 4, 98, 35, 8, 87, 4, 98, 35)),
  125. array('name'=>'aaa','type'=>'line',
  126. 'smooth'=> true,
  127. 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(219, 50, 51, 0.3)",'type'=>'default'))),
  128. 'data'=> array(85, 3, 8, 54, 4, 98, 35, 8, 3, 4, 101, 35))
  129. */);
  130. echo json_encode($list);
  131. }
  132. public function openowner(){
  133. $this->display('onpenowner');
  134. }
  135. }