userractModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. class flow_userractClassModel extends flowModel
  3. {
  4. protected $flowcompanyidfieds = 'companyid';
  5. public $statearr;
  6. public function initModel()
  7. {
  8. $this->statearr = explode(',','<font color=blue>待执行</font>,<font color=green>生效中</font>,<font color=#888888>已终止</font>,<font color=red>已过期</font>');
  9. }
  10. public function flowrsreplace($rs, $lx=0)
  11. {
  12. $rs['state'] = $this->statearr[$rs['state']];
  13. if(isset($rs['newname']) && !isempt($rs['newname']) && $rs['newname']!=$rs['uname'])$this->update("`uname`='".$rs['newname']."'",$rs['id']);
  14. if($lx==1){
  15. $rs['deptname'] = $this->adminmodel->getmou('deptname', $rs['uid']);
  16. }
  17. return $rs;
  18. }
  19. public function updatestate()
  20. {
  21. $dt = $this->rock->date;
  22. $this->update("`state`=2", "`tqenddt` is not null and `tqenddt`<`enddt` and `tqenddt`<'$dt'");
  23. $this->update("`state`=1", "`startdt`<='$dt' and `enddt`>='$dt' and `tqenddt` is null");
  24. $this->update("`state`=3", "`enddt`<'$dt' and `tqenddt` is null");
  25. $this->update("`state`=0", "`startdt`>'$dt'");
  26. }
  27. protected function flowbillwhere($uid, $lx)
  28. {
  29. $this->updatestate();
  30. $table = '`[Q]userract` a left join `[Q]admin` b on a.uid=b.id';
  31. return array(
  32. 'where' => '',
  33. 'table' => $table,
  34. 'fields'=> 'a.*,b.deptname,b.`name` as newname',
  35. 'orlikefields'=>'b.deptname',
  36. 'order' => 'a.`optdt` desc',
  37. 'asqom' => 'a.'
  38. );
  39. }
  40. }
粤ICP备19079148号