imgroupAction.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. class imgroupClassAction extends Action
  3. {
  4. public function groupusershow($table)
  5. {
  6. $s = 'and 1=2';
  7. $gid = $this->post('gid','0');
  8. if($gid>0){
  9. $s = " and id in(select `uid` from `[Q]im_groupuser` where `gid`='$gid')";
  10. }
  11. return array(
  12. 'where' => $s,
  13. 'fields'=> 'id,user,name,deptname,ranking'
  14. );
  15. }
  16. public function groupafter($table, $rows)
  17. {
  18. foreach($rows as $k=>$rs){
  19. $gid = $rs['id'];
  20. $s = "`gid`='$gid'";
  21. $rows[$k]['utotal'] = $this->db->rows('[Q]im_groupuser', $s);
  22. }
  23. return array('rows'=>$rows);
  24. }
  25. public function saveuserAjax()
  26. {
  27. $gid = (int)$this->post('gid','0');
  28. $sid = c('check')->onlynumber($this->post('sid'));
  29. m('reim')->adduserchat($gid, $sid, true);
  30. echo 'success';
  31. }
  32. public function deluserAjax()
  33. {
  34. $gid = (int)$this->post('gid','0');
  35. $sid = c('check')->onlynumber($this->post('sid','0'));
  36. m('reim')->exitchat($gid, $sid);
  37. echo 'success';
  38. }
  39. //保存组织结构
  40. public function savegroupafter($table, $arr, $id)
  41. {
  42. m('imgroup')->updateguser($id, $arr['deptid']);
  43. $rs = m($table)->getone($id);
  44. if(isempt($rs['createname'])){
  45. m($table)->update(array(
  46. 'createid' => $this->adminid,
  47. 'createname' => $this->adminname,
  48. 'createdt' => $this->now,
  49. ),$id);
  50. }
  51. }
  52. public function reloadallAjax()
  53. {
  54. m('imgroup')->updategall();
  55. }
  56. }
粤ICP备19079148号