diff --git a/backstage/system/libraries/Recharge_config.php b/backstage/system/libraries/Recharge_config.php index 897df21..6ec7f56 100644 --- a/backstage/system/libraries/Recharge_config.php +++ b/backstage/system/libraries/Recharge_config.php @@ -108,10 +108,10 @@ class CI_Recharge_config { private function get_recharge_count($userId, $gift_type){ if($gift_type == 1){ // 每年赠送 - return $this->CI->db->query("select count(id) as num from tb_recharge where user_id=? and type=1 and YEAR(record_datetime) = YEAR(CURDATE())", array($userId))->row()->num; + return $this->CI->db->query("select count(a.id) as num from tb_recharge a, tb_account b where a.account_id=b.id and b.type_id=2 and a.user_id=? and a.type=1 and YEAR(record_datetime) = YEAR(CURDATE())", array($userId))->row()->num; }else{ // 每次赠送 - return $this->CI->db->query("select count(id) as num from tb_recharge where user_id=? and type=1", array($userId))->row()->num; + return $this->CI->db->query("select count(a.id) as num from tb_recharge a, tb_account b where a.account_id=b.id and b.type_id=2 and a.user_id=? and a.type=1", array($userId))->row()->num; } }