Blame view

apps/product/models/coupon-service.js 524 Bytes
htoooth authored
1 2 3
/**
 * Created by TaoHuang on 2016/10/28.
 */
htoooth authored
4 5 6

'use strict';
htoooth authored
7
const CouponApi = require('./coupon-api');
htoooth authored
8 9
const _ = require('lodash');
const decrypt = _.partial(global.yoho.crypto.decrypt, null);
htoooth authored
10
htoooth authored
11
htoooth authored
12 13 14 15 16 17
module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);

        this.api = new CouponApi(ctx);
htoooth authored
18
        this.listAsync = this.api.listAsync.bind(this.api);
htoooth authored
19 20 21 22 23 24 25
    }

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

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