kqdwModel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. class flow_kqdwClassModel extends flowModel
  3. {
  4. protected $flowcompanyidfieds = 'uid'; //多单位用这个关联
  5. public $dateobj,$typearr;
  6. public function initModel()
  7. {
  8. $this->dateobj = c('date');
  9. $this->typearr = explode(',','普通,事件,企业微信定位');
  10. }
  11. //打开详情时跳转到地理位置显示
  12. protected function flowchangedata()
  13. {
  14. if(!isajax() && !isempt($this->rs['location_x'])){
  15. $url = 'index.php?m=kaoqin&a=location&d=main&id='.$this->id.'';
  16. $this->rock->location($url);
  17. exit();
  18. }
  19. }
  20. /**
  21. * 显示条件过滤
  22. */
  23. protected function flowbillwhere($uid, $lx)
  24. {
  25. $atype = $lx;
  26. $dt1 = $this->rock->post('dt1');
  27. $dt2 = $this->rock->post('dt2');
  28. $key = $this->rock->post('key');
  29. $s = '';
  30. $s = ' and b.id='.$this->adminid.'';
  31. //全部下属打卡
  32. if($lx=='down'){
  33. $s = 'and '.$this->adminmodel->getdownwheres('b.id', $uid, 0);
  34. }
  35. if($atype=='all')$s ='';
  36. if(!isempt($dt1))$s.=" and a.`optdt`>='$dt1'";
  37. if(!isempt($dt2))$s.=" and a.`optdt`<='$dt2 23:59:59'";
  38. if(!isempt($key))$s.=" and (b.`name` like '%$key%' or b.`deptallname` like '%$key%' or b.`ranking` like '%$key%')";
  39. $fields = 'a.*,b.name,b.deptname';
  40. $tabls = $this->mtable;
  41. $table = '`[Q]'.$tabls.'` a left join `[Q]userinfo` b on a.uid=b.id';
  42. return array(
  43. 'where' => $s,
  44. 'table' => $table,
  45. 'order' => 'a.`id` desc',
  46. 'fields'=> $fields
  47. );
  48. }
  49. //替换
  50. public function flowrsreplace($rs, $lx=0)
  51. {
  52. $week = $this->dateobj->cnweek($rs['optdt']);
  53. $rs['week'] = $week;
  54. if($week=='六' || $week=='日')$rs['ishui']= 1;
  55. $rs['type']= arrvalue($this->typearr, $rs['type']);
  56. return $rs;
  57. }
  58. }
粤ICP备19079148号