__construct(); } function get_list($offset=0,$psize=30) { $sql = "SELECT id,username, (SELECT SUM(money) from ".$this->db->prefix."commission where uid=".$this->db->prefix."user.id) as sumMoney,(SELECT count(id) from ".$this->db->prefix."customer where uid=".$this->db->prefix."user.id) as sumCount FROM ".$this->db->prefix."user ORDER BY sumMoney DESC,sumCount DESC,id DESC LIMIT ".$offset.",".$psize; //$sql="SELECT id,username, (SELECT SUM(money) from lyfz_commission where uid=lyfz_user.id) as sumMoney,(SELECT SUM(id) from lyfz_customer where uid=lyfz_user.id) as sumCount from lyfz_user ORDER BY sumMoney DESC,sumCount desc"; return $this->db->get_all($sql); } function get_count() { $sql = "SELECT id,username, (SELECT SUM(money) from ".$this->db->prefix."commission where uid=".$this->db->prefix."user.id) as sumMoney,(SELECT SUM(id) from ".$this->db->prefix."customer where uid=".$this->db->prefix."user.id) as sumCount FROM ".$this->db->prefix."user ORDER BY sumMoney DESC,sumCount DESC"; return $this->db->count($sql); } function customer_from_id($id) { $this->db->close_cache(); $sql = "SELECT * FROM ".$this->db->prefix."customer WHERE id='".$id."'"; $rs = $this->db->get_one($sql); if(!$rs) return false; $this->db->open_cache(); return $rs; } } ?>