customer.php 766 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class customer_m extends Model
  3. {
  4. function __construct()
  5. {
  6. parent::Model();
  7. }
  8. function customer_m()
  9. {
  10. $this->__construct();
  11. }
  12. function get_list($uid,$offset=0,$psize=30)
  13. {
  14. $sql = "SELECT * FROM ".$this->db->prefix."customer WHERE uid='".$uid."' ORDER BY postdate DESC,id DESC LIMIT ".$offset.",".$psize;
  15. return $this->db->get_all($sql);
  16. }
  17. function get_count($uid)
  18. {
  19. $sql = "SELECT count(id) total FROM ".$this->db->prefix."customer WHERE uid='".$uid."' ";
  20. return $this->db->count($sql);
  21. }
  22. function customer_from_id($id)
  23. {
  24. $this->db->close_cache();
  25. $sql = "SELECT * FROM ".$this->db->prefix."customer WHERE id='".$id."'";
  26. $rs = $this->db->get_one($sql);
  27. if(!$rs) return false;
  28. $this->db->open_cache();
  29. return $rs;
  30. }
  31. }
  32. ?>