personal.php 950 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class personal_m extends Model
  3. {
  4. function __construct()
  5. {
  6. parent::Model();
  7. }
  8. function personal_m()
  9. {
  10. $this->__construct();
  11. }
  12. function get_list($uid,$offset=0,$psize=30)
  13. {
  14. $sql = "SELECT * FROM ".$this->db->prefix."commission WHERE uid='".$uid."' ORDER BY postdate DESC,id DESC LIMIT ".$offset.",".$psize;
  15. return $this->db->get_all($sql);
  16. }
  17. //获取所有已推荐客户
  18. function get_count_all($uid)
  19. {
  20. $sql = "SELECT count(id) from ".$this->db->prefix."customer where uid=".$uid;
  21. return $this->db->count($sql);
  22. }
  23. //获取所有已成交的推荐客户
  24. function get_count_ok($uid)
  25. {
  26. $sql = "SELECT count(id) from ".$this->db->prefix."customer where huikuan=1 and uid=".$uid;
  27. return $this->db->count($sql);
  28. }
  29. function get_count_cur($uid,$status=0)
  30. {
  31. $sql = "SELECT sum(money) total FROM ".$this->db->prefix."commission WHERE uid='".$uid."' and status='".$status."' ";
  32. return $this->db->count($sql);
  33. }
  34. }
  35. ?>