reimplatAction.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * 作者:信呼开发团队(雨中磐石)
  4. * 官网:http://www.rockoa.com
  5. * 软件:信呼OA
  6. * REIM即使通信平台回调
  7. */
  8. class reimplatClassAction extends apiAction{
  9. public function initAction()
  10. {
  11. $this->display= false;
  12. }
  13. //平台上通知过来的数据
  14. public function indexAction()
  15. {
  16. return 'success'; //这个用不到就直接返回了
  17. $body = $this->getpostdata();
  18. if(!$body)return;
  19. $db = m('reimplat:dept');
  20. $key = $db->gethkey();
  21. $bodystr = $this->jm->strunlook($body, $key);
  22. if(!$bodystr)return;
  23. $data = json_decode($bodystr, true);
  24. $msgtype = arrvalue($data,'msgtype');
  25. $msgevent= arrvalue($data,'msgevent');
  26. //用户状态改变停用
  27. if($msgtype=='subscribe'){
  28. $user = arrvalue($data, 'user');
  29. $zt = '0';
  30. if($msgevent=='yes')$zt = '1';
  31. if($msgevent=='stop')$zt = '2';
  32. $db->update('`status`='.$zt.'',"`user`='$user'");
  33. }
  34. //修改手机号
  35. if($msgtype=='editmobile'){
  36. $user = arrvalue($data, 'user');
  37. $mobile = arrvalue($data, 'mobile');
  38. $where = "`user`='$user'";
  39. $upstr = "`mobile`='$mobile'";
  40. $db->update($upstr, $where);
  41. $dbs = m('admin');
  42. $dbs->update($upstr,$where);
  43. $uid = $dbs->getmou('id',$where);
  44. m('userinfo')->update($upstr,"`id`='$uid'");
  45. }
  46. //修改密码
  47. if($msgtype=='editpass'){
  48. $user = arrvalue($data, 'user');
  49. $pass = arrvalue($data, 'pass');
  50. if($pass && $user){
  51. $where = "`user`='$user'";
  52. $mima = md5($pass);
  53. m('admin')->update("`pass`='$mima',`editpass`=`editpass`+1", $where);
  54. }
  55. }
  56. }
  57. }
粤ICP备19079148号