indexAction.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. class indexClassAction extends Action{
  3. private function homeicons()
  4. {
  5. $myext = $this->getsession('adminallmenuid');
  6. $where = '';
  7. if($myext != '-1'){
  8. $caids = str_replace(array('[',']'), array('',''), $myext);
  9. if(isempt($caids))$caids='0';
  10. $where = ' and `id` in('.$caids.')';
  11. }
  12. $mrows = m('menu')->getrows("`ishs`=1 and `status`=1 $where ", "`id`,`num`,`name`,`url`,`color`,`icons`",'`sort`');
  13. if(LANG!='zh-CN')foreach($mrows as $k=>$rs)$mrows[$k]['name'] = lang($rs['name'],'menu');
  14. return $mrows;
  15. }
  16. public function gettotalAjax()
  17. {
  18. $loadci = (int)$this->get('loadci','0');
  19. $optdta = $this->get('optdt');
  20. $optdt = $this->now;
  21. $uid = $this->adminid;
  22. $urs = m('admin')->getone("`id`='$uid' and `status`=1");
  23. if(!$urs)exit('用户不存在');
  24. $arr['optdt'] = $optdt;
  25. $todo = m('todo')->rows("uid='$uid' and `status`=0 and `tododt`<='$optdt'");
  26. $arr['todo'] = $todo;
  27. $arr['reimstotal'] = 0;
  28. if(getconfig('reim_show',true))$arr['reimstotal'] = m('reim')->getreimwd($uid);
  29. if($loadci==0){
  30. $arr['showkey'] = $this->jm->base64encode($this->jm->getkeyshow());
  31. $arr['menuarr'] = $this->homeicons();
  32. $arr['token'] = $this->admintoken;
  33. $arr['authkey'] = $this->option->getval('auther_authkey');
  34. $_key = substr(md5(URL.getconfig('randkey')),0,20);
  35. $usedt = $this->option->getval($_key);
  36. if(isempt($usedt)){
  37. $usedt = $this->jm->base64encode(date('Y-m-d', time()+7*24*3600));
  38. $this->option->setval($_key.'@-102', $usedt);
  39. }
  40. $arr['usedt'] = $usedt;
  41. if(!isempt($arr['authkey'])){
  42. $ybarr = $this->option->authercheck();
  43. if(is_string($ybarr))$arr['authmsg'] = $this->jm->base64encode($ybarr);
  44. }
  45. if(DB_USER=='root'){
  46. $sqld = $this->db->getall('select @@global.sql_mode as total');
  47. if($sqld){
  48. $sqlmodel = $sqld[0]['total'];
  49. $arr['sqlmodel'] = $sqlmodel;
  50. $sqlsr = explode(',', $sqlmodel);
  51. $kes = 'ONLY_FULL_GROUP_BY';
  52. $nstr = array();
  53. if(in_array($kes, $sqlsr))foreach($sqlsr as $_kt)if($_kt!=$kes)$nstr[]=$_kt;
  54. if($nstr)$this->db->query("set @@global.sql_mode ='".join(',', $nstr)."'",false);
  55. }
  56. }
  57. }
  58. $s = $s1 = '';
  59. if($loadci==0){
  60. if($todo>0){
  61. $s = '您还有<font color=red>('.$todo.')</font>条未读提醒信息;<a onclick="return opentixiangs()" href="javascript:">[查看]</a>';
  62. $s1= '您还有('.$todo.')条未读提醒信息;';
  63. }
  64. }else{
  65. m('dept')->online(1);//在线状态更新
  66. if($todo>0){
  67. $rows = m('todo')->getrows("uid='$uid' and `status`=0 and `optdt`>'$optdta' and `tododt`<='$optdt' order by `id` limit 3");
  68. foreach($rows as $k=>$rs){
  69. $s .= ''.($k+1).'、['.$rs['title'].']'.$rs['mess'].'。<br>';
  70. $s1.= ''.($k+1).'、['.$rs['title'].']'.$rs['mess'].'。'."\n";
  71. }
  72. }
  73. }
  74. $msgar[0] = $s;
  75. $msgar[1] = $s1;
  76. $arr['msgar'] = $msgar; //右下角提示
  77. //桌面项的数据和红数字统计
  78. $itemsarr = m('homeitems')->getitemsdata($this->get('nums'));
  79. foreach($itemsarr as $k=>$v)$arr[$k] = $v;
  80. $arr['notodo'] = $this->option->getval('gerennotodo_'.$uid.'');
  81. $arr['editpass']= m('admin')->iseditpass($uid);
  82. $arr['miaoshu'] = (int)$this->option->getval('syshometime', '200');
  83. $arr['tanwidth']= $this->option->getval('tanwidth', '900x800');
  84. $arr['htimeout']= (int)getconfig('hoemtimeout','0');
  85. return $arr;
  86. }
  87. //显示手机版二维码
  88. public function getqrcoresAjax()
  89. {
  90. if(!function_exists('ImageCreate')){
  91. echo ''.URL.'?d=we';
  92. }else{
  93. echo 'ok';
  94. }
  95. }
  96. public function getqrcodeAjax()
  97. {
  98. header("Content-type:image/png");
  99. $urls= $this->rock->getouturl();
  100. c('cache')->set('login'.$this->adminuser.'', $this->adminid, 300);
  101. $url = ''.$urls.'?m=login&d=we&token='.$this->admintoken.'&user='.$this->jm->base64encode($this->adminuser).'';
  102. if(COMPANYNUM)$url.='&dwnum='.COMPANYNUM.'';
  103. $img = c('qrcode')->show($url);
  104. echo $img;
  105. }
  106. }
粤ICP备19079148号