123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- class IndexController extends Controller {
- public function _initialize(){
- $dat['address'] = convertip_full('114.95.160.191');
-
- if(!session('zt_uid')){
- redirect(U('Public/login'));
- }
- }
-
- public function index(){//加载菜单,主页
- $Uid=session('zt_uid');
- $Ids = array();//保存用户所属用户组设置的所有权限规则id
- if(!in_array($Uid,C('ADMINISTRATOR'))){
- $UserAccess = M('auth_group_access');
- $Map['uid'] = $Uid;
- $Map['`status`']=1;
- $DataList = $UserAccess->join('sp_auth_group on group_id=id')->where($Map)->field("rules")->select();
- echo $UserAccess->getLastSql();
- print_r($DataList);
- // s_print($DataList);
- foreach ($DataList as $g) {
- $Ids = array_merge($Ids, explode(',', trim($g['rules'], ',')));
- }
- $Ids = array_unique($Ids);
- }else{
- $Ids="ADMINISTRATOR";
- }
-
- if(empty($Ids)){
- exit('很抱歉,您没有任何权限!请联系管理员!');
- }
- if(IS_POST){
- $do=I('post.dosubmit','');
- if ($do){
- $sql="select * from sp_movewater where time>=DATE_SUB(NOW(),INTERVAL 1 MINUTE)";
- $res = M()->query($sql);
- if($res){
- $data['status']=1;
- $data['info']=$res;
- }else{
- $data['status']=0;
- }
- echo json_encode($data);exit;
- }
- }
- //$AgentSatusCfg=M('v_status_cfg')->select();
- //$this->assign('AgentSatusCfg',$AgentSatusCfg);
- $this->assign('Username',session('zt_username'));
- $this->assign('menulistlv1',$this->menu(1,$Ids));
- $this->assign('menulistlv2',$this->menu(2,$Ids));
- $this->assign('menulistlv3',$this->menu(3,$Ids));
- $ResData=GetUser();
- $Extension=session('zt_extension');
- $this->assign('cubeDn',$Extension);
- $this->assign('bian',$ResData['bian']);
- $this->assign('cubeId',$ResData['agentid']);
- $this->assign('uid',session('zt_username'));
- $this->assign('pad',session('zt_password'));
- $this->display();
- }
-
- public function menu($part1,$part2){
- if($part2==="ADMINISTRATOR"){
- $Map=array('status'=>1,'system_type'=>1,'types'=>1,'level'=> $part1);
- }
- else{
- $Map=array('id'=>array('in',$part2),'status'=>1,'system_type'=>1,'types'=>1,'level'=> $part1);
- }
- $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();
- return $Rules ;
- }
- public function home(){
- $Data=I();
- if(IS_POST){
- $Data['id']=session('zt_uid');
- M('user')->data($Data)->save();
- exit(json_encode(array('statusCode'=>200,'message'=>'保存成功')));
- }
- $ResData= M('user')->getByUsername(session('zt_username'));
- $this->assign('bian',$ResData['bian']);
- $this->display('Index/tablemb');
- }
- public function CharData(){
-
- $list=array();
- //$list['title']=array('text'=>"某楼盘销售情况",'subtext'=>"纯属虚构");
- $list['tooltip']=array('trigger'=>"axis");// axisPointer:{type: 'none'}
- $list['legend']=array('data'=> array("男","女","aaa"));
- $list['toolbox']=array('show'=> true,'feature'=> array(
- 'mark'=> array('show'=> true),
- 'dataView'=> array('show'=> true,'readOnly'=> false),
- 'magicType'=> array('show'=> true,'type'=> array("line","bar",'stack', 'tiled')),//add
- 'restore'=> array('show'=> true),
- 'saveAsImage'=> array('show'=> true)
- ));
- $list['dataZoom']= array('show'=> true,'zoomlock'=>true,'realtime'=> true, 'start'=> 12, 'end'=> 98);
- $list['calculable']=true;
- $list['animation']=false;
- $list['xAxis']=array(
- array('type'=>"category",
- 'boundaryGap'=> false,//add
- 'data'=> array("1月",
- "2月",
- "3月",
- "4月",
- "5月",
- "6月",
- "7月",
- "8月",
- "9月",
- "10月",
- "11月",
- "12月"))
- );
- $list['yAxis']=array(array('type'=>'value'));//,'splitArea'=> array('show'=> true)
- $list['series']=array(
- array('name'=>'男','type'=>'line',
- 'smooth'=> true,
- //'symbol'=>'circle',
- //'symbolSize'=> 5,
- 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(137, 189, 27, 0.3)",'type'=>'default'))),
- 'data'=> array(10, 12, 21, 54, 15, 5, 8, 21, 54, 15, 5, 8)),
-
- /*array('name'=>'女','type'=>'line',
- 'smooth'=> true,
- 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(0, 136, 212, 0.3)",'type'=>'default'))),
- 'data'=> array(5, 3, 8, 87, 4, 98, 35, 8, 87, 4, 98, 35)),
- array('name'=>'aaa','type'=>'line',
- 'smooth'=> true,
- 'itemStyle'=> array('normal'=> array('areaStyle'=> array('color'=>"rgba(219, 50, 51, 0.3)",'type'=>'default'))),
- 'data'=> array(85, 3, 8, 54, 4, 98, 35, 8, 3, 4, 101, 35))
- */);
- echo json_encode($list);
- }
- public function openowner(){
- $this->display('onpenowner');
- }
- }
|