Model_check.php 966 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Model_check extends Lin_Model
  3. {
  4. function __construct(){
  5. parent::__construct();
  6. $this->load->database();
  7. $this->table = 'check';
  8. $this->load_table('check');
  9. }
  10. public function checkOverdue($check_name,$number,$check_address){
  11. $check_name = trim($check_name);
  12. $check_address = trim($check_address);
  13. if(empty($check_name) || empty($check_address)){
  14. return false;
  15. }
  16. $info = $this->find("(check_name = '".$check_name."') or (check_address = '".$check_address."')","*",'addtime DESC');
  17. if(empty($info)){
  18. }else{
  19. if((time() - $info['addtime'] ) < $info['zx_hours']*60*60 ){
  20. if($info['number'] == $number){
  21. return true;
  22. }
  23. return false;
  24. }
  25. }
  26. $this->insert([
  27. 'check_address' => $check_address,
  28. 'check_name' => $check_name,
  29. 'number' => $number,
  30. 'addtime' => time(),
  31. 'zx_hours'=> 72
  32. ]);
  33. return true;
  34. }
  35. } //end class