coupon-api.js 658 Bytes
module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }

    getCouponList(uid, type, page, extra) {
        extra = extra || {};

        let reqData = {
            method: 'app.coupons.get',
            uid: uid,
            type: type || 'notuse',
            page: page || 1,
            limit: extra.limit || 10
        };

        if (extra.filter) {
            reqData.filter = extra.filter;
        }

        return this.get({data: reqData});
    }

    getCouponNum(uid) {
        return this.get({data: {
            method: 'app.coupons.getCouponNums',
            uid: uid
        }});
    }
};