indexAction.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. class indexClassAction extends apiAction
  3. {
  4. public function indexAction()
  5. {
  6. $this->showreturn('','error', 203);
  7. }
  8. /**
  9. * 手机app读取
  10. */
  11. public function indexinitAction()
  12. {
  13. $dbs = m('reim');
  14. $ntime = floatval($this->post('ntime'));
  15. $uid = $this->adminid;
  16. $arr['loaddt'] = $this->now;
  17. $arr['splittime'] = (int)($ntime/1000-time());
  18. $arr['reimarr'] = $dbs->gethistory($uid);
  19. $this->showreturn($arr);
  20. }
  21. /**
  22. * app首页接口截止
  23. */
  24. public function indexappAction()
  25. {
  26. $dbs = m('reim');
  27. $ntime = floatval($this->post('ntime'));
  28. $uid = $this->adminid;
  29. $agent = $dbs->getappagent($uid);
  30. $arr['loaddt'] = $this->now;
  31. $arr['splittime'] = (int)($ntime/1000-time());
  32. $arr['reimarr'] = $dbs->gethistory($uid);
  33. $arr['agentarr'] = $agent['rows'];
  34. $arr['agentstotal'] = $agent['stotal'];
  35. $arr['maxupsize'] = c('upfile')->getmaxzhao();//最大上传大小M
  36. $arr['appversion'] = $this->get('appversion');
  37. $arr['xinhuver'] = VERSION;
  38. $arr['wsconfig'] = $dbs->getreims();
  39. $this->showreturn($arr);
  40. }
  41. public function lunxunAction()
  42. {
  43. $uid = $this->adminid;
  44. $loaddt = $this->post('loaddt');
  45. //$reimarr = m('reim')->getwdarr($uid, $loaddt);
  46. $reimarr = m('reim')->gethistory($uid, $loaddt);
  47. $arr['reimarr'] = $reimarr;
  48. $arr['loaddt'] = $this->now;
  49. m('login')->uplastdt();
  50. $this->showreturn($arr);
  51. }
  52. //应用获取数据
  53. public function getyydataAction()
  54. {
  55. $num = $this->post('num');
  56. $event = $this->post('event');
  57. $page = (int)$this->post('page');
  58. $rows = m('agent:'.$num.'')->getdata($this->adminid, $num, $event, $page);
  59. return returnsuccess($rows);
  60. }
  61. public function initApiCheck()
  62. {
  63. //额外判断的是从业主那读取数据
  64. if(A=='getyydata'){
  65. $openlx = (int)$this->get('openlx','0');
  66. if($openlx == 4){
  67. $num = $this->get('num');
  68. $to = m('im_group')->rows("`num`='$num' and `type`=2 and `types`='业主'");
  69. if($to == 1)return true;
  70. }
  71. }
  72. return false;
  73. }
  74. public function yyoptmenuAction()
  75. {
  76. $num = $this->post('modenum');
  77. $sm = $this->post('sm');
  78. $optid = (int)$this->post('optmenuid');
  79. $zt = (int)$this->post('statusvalue');
  80. $mid = (int)$this->post('mid');
  81. $msg = m('flow')->opt('optmenu', $num, $mid, $optid, $zt, $sm);
  82. if($msg != 'ok')$this->showreturn('', $msg, 201);
  83. $this->showreturn('');
  84. }
  85. public function changetxAction()
  86. {
  87. $apptx = (int)$this->post('apptx');
  88. m('admin')->update("`apptx`='$apptx'", $this->adminid);
  89. $this->showreturn('');
  90. }
  91. public function checkewmAction()
  92. {
  93. $randkey = $this->get('randkey');
  94. $lx = (int)$this->get('lx');
  95. $val = $this->adminid;
  96. $lxarr = array('已取消','已确认');
  97. if($lx==0)$val='-1';
  98. c('cache')->set($randkey,$val,60);
  99. $this->showreturn($lxarr[$lx]);
  100. }
  101. /**
  102. * 切换公司
  103. */
  104. public function changecompanyAction()
  105. {
  106. $id = (int)$this->get('id');
  107. $db = m('admin');
  108. $db->update('comid='.$id.'', '`id`='.$this->adminid.'');
  109. $db->getcompanyinfo();
  110. return returnsuccess();
  111. }
  112. public function getcompanyAction()
  113. {
  114. $carr = m('admin')->getcompanyinfo($this->adminid);
  115. $this->showreturn($carr);
  116. }
  117. /**
  118. * 华为设置客户端token
  119. */
  120. public function updateTokenIpAction()
  121. {
  122. $hwtoken = $this->get('hwtoken');
  123. $pushtoken = $this->get('pushtoken');
  124. $appver = $this->get('appversion');
  125. $web = $this->get('web');
  126. $ispush = (int)$this->get('ispush','0');
  127. if($appver)$pushtoken.='_'.$appver.'';
  128. $uarr['ispush'] = $ispush;
  129. $uarr['pushtoken'] = $pushtoken;
  130. $uarr['moddt'] = $this->now;
  131. if(!isempt($hwtoken))$uarr['ip'] = $hwtoken;
  132. if(!isempt($web))$uarr['web'] = $web;
  133. m('login')->update($uarr, "`token`='$this->admintoken'");
  134. if($ispush==1)m('reim')->sendpush($this->adminid, 'all', array(
  135. 'type' => 'onoffline',
  136. 'online' => 2
  137. ));
  138. return returnsuccess();
  139. }
  140. /**
  141. * 注册了极光推送
  142. */
  143. public function updateJPushAction()
  144. {
  145. $allfields = $this->db->getallfields('[Q]logintoken');
  146. if(!in_array('regid', $allfields)){
  147. $this->db->addFields('[Q]logintoken','regid','varchar(100)',null,'注册客户端id');
  148. }
  149. $regid = $this->get('regid');
  150. $uarr['regid'] = $regid;
  151. $uarr['moddt'] = $this->now;
  152. if(!isempt($regid))$uarr['ispush'] = 1;
  153. m('login')->update($uarr, "`token`='$this->admintoken'");
  154. return returnsuccess();
  155. }
  156. public function addlogAction()
  157. {
  158. $tit = $this->post('title');
  159. $cont = $this->post('cont');
  160. $web = $this->post('web');
  161. $level = (int)$this->post('level','0');
  162. m('log')->addlogs($tit, $cont,$level, array(
  163. 'web' => $web,
  164. ));
  165. return returnsuccess();
  166. }
  167. public function sgstrs()
  168. {
  169. }
  170. }
粤ICP备19079148号