userractModel.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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)
  11. {
  12. $rs['state'] = $this->statearr[$rs['state']];
  13. return $rs;
  14. }
  15. public function updatestate()
  16. {
  17. $dt = $this->rock->date;
  18. $this->update("`state`=2", "`tqenddt` is not null and `tqenddt`<`enddt` and `tqenddt`<'$dt'");
  19. $this->update("`state`=1", "`startdt`<='$dt' and `enddt`>='$dt' and `tqenddt` is null");
  20. $this->update("`state`=3", "`enddt`<'$dt' and `tqenddt` is null");
  21. $this->update("`state`=0", "`startdt`>'$dt'");
  22. }
  23. protected function flowbillwhere($uid, $lx)
  24. {
  25. $this->updatestate();
  26. $table = '`[Q]userract` a left join `[Q]admin` b on a.uid=b.id';
  27. return array(
  28. 'where' => '',
  29. 'table' => $table,
  30. 'fields'=> 'a.*,b.deptname',
  31. 'orlikefields'=>'b.deptname',
  32. 'order' => 'a.`optdt` desc',
  33. 'asqom' => 'a.'
  34. );
  35. }
  36. }
粤ICP备19079148号