mode_carmreseAction.php 1.0 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class mode_carmreseClassAction extends inputAction{
  3. protected function savebefore($table, $arr, $id, $addbo){
  4. $msg = '';
  5. $startdt = $arr['startdt'];
  6. $enddt = $arr['enddt'];
  7. $carid = $arr['carid'];
  8. if($startdt>=$enddt)$msg='截止时间小于开始时间,不科学啊';
  9. if($msg==''){
  10. $tj1 = "`returndt` is null and ((`startdt`<='$startdt' and `enddt`>='$startdt') or (`startdt`<='$enddt' and `enddt`>='$enddt') or (`startdt`>='$startdt' and `enddt`<='$enddt'))"; //未归还
  11. $tj2 = "`returndt` is not null and ((`startdt`<='$startdt' and `returndt`>='$startdt') or (`startdt`<='$enddt' and `returndt`>='$enddt') or (`startdt`>='$startdt' and `returndt`<='$enddt'))"; //已归还
  12. $where = "id <>'$id' and `carid` = '$carid' and `status` in(0,1) and (($tj1) or ($tj2))";
  13. if(m($table)->rows($where)>0)$msg='车辆该时间段已被预定了';
  14. }
  15. return array('msg'=>$msg);
  16. }
  17. protected function saveafter($table, $arr, $id, $addbo){
  18. }
  19. }
粤ICP备19079148号