fix
This commit is contained in:
@@ -56,10 +56,12 @@ logfmt(logINFO, "coupons_calls()");
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WRENCHBOARD_COUPON_MEMLIST: // member list
|
case WRENCHBOARD_COUPON_MEMLIST: // member list
|
||||||
|
in["mode"] = 100; in["mode"].set_valid( true );
|
||||||
return MemberCouponList(in, out);
|
return MemberCouponList(in, out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRENCHBOARD_COUPON_PENDLIST: // member list
|
case WRENCHBOARD_COUPON_PENDLIST: // member list
|
||||||
|
in["mode"] = 200; in["mode"].set_valid( true );
|
||||||
return MemberCouponList(in, out);
|
return MemberCouponList(in, out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -179,9 +181,18 @@ long MemberCouponList( CVars in, CVars &out ){
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
REQ_LONG(in, "member_id", 1, -1);
|
REQ_LONG(in, "member_id", 1, -1);
|
||||||
|
long mode = REQ_LONG(in, "mode", 1, -1);
|
||||||
|
|
||||||
|
in["active_q"] = "ca.active IS NOT NULL";
|
||||||
|
if ( mode == 200 ){
|
||||||
|
in["active_q"] = "ca.active IS NULL";
|
||||||
|
}
|
||||||
|
in["active_q"].set_valid( true );
|
||||||
|
|
||||||
out["total_record"] = "0";
|
out["total_record"] = "0";
|
||||||
const PGresult *res;
|
const PGresult *res;
|
||||||
res = pgsql_query("SELECT id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status FROM coupons_allocation ca WHERE ca.member_id = %lu AND ca.active IS NULL ORDER BY ca.id DESC", in["member_id"].Long());
|
|
||||||
|
res = pgsql_query("SELECT id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status FROM coupons_allocation ca WHERE ca.member_id = %lu AND %s ORDER BY ca.id DESC", in["member_id"].Long(),in["active_q"].c_str());
|
||||||
|
|
||||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||||
out["total_record"] = pgsql_num_rows(res);
|
out["total_record"] = pgsql_num_rows(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user