coupon-service.js 524 Bytes
/**
 * Created by TaoHuang on 2016/10/28.
 */

'use strict';

const CouponApi = require('./coupon-api');
const _ = require('lodash');
const decrypt = _.partial(global.yoho.crypto.decrypt, null);


module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);

        this.api = new CouponApi(ctx);

        this.listAsync = this.api.listAsync.bind(this.api);
    }

    acquireAsync(cid, uid) {
        let dcid = decrypt(cid);

        return this.api.acquireAsync(dcid, uid);
    }
};