24 lines
758 B
PHP
24 lines
758 B
PHP
<?php
|
|
|
|
class Coupon_model extends CI_Model {
|
|
|
|
function __construct() {
|
|
|
|
}
|
|
|
|
|
|
public function loadMemberActiveCoupons($member_id,$fliters=[]){
|
|
$sql="SELECT id, ca.code, ca.amount, ca.added::date,ca.status
|
|
FROM coupons_allocation ca WHERE ca.member_id = $member_id AND ca.active IS NULL ORDER BY ca.id DESC";
|
|
$q = $this->db->query($sql);
|
|
return $q;
|
|
}
|
|
|
|
public function loadMemberRedeemCoupons($member_id,$fliters=[]){
|
|
$sql="SELECT id, ca.code, ca.amount, ca.added::date,ca.status ,ca.active::date
|
|
FROM coupons_allocation ca WHERE ca.member_id = $member_id AND ca.active IS NOT NULL ORDER BY ca.id DESC";
|
|
$q = $this->db->query($sql);
|
|
return $q;
|
|
}
|
|
|
|
} |