user-data.js 1.3 KB
'use strict';

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

    getVIPInfoByUid(uid) {
        let options = {
            method: 'app.passport.growthvip',
            uid: uid
        };

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

    /**
     * [vip累计记录]
     * @param  {[uid:uid,limit:每页数量, page:第几页]} params [参数]
     * @return {[type]}        [description]
     */
    getVipRecord(params) {
        let options = {
            method: 'app.passport.growthhistory'
        };

        if (params.type === 2) {
            options = Object.assign({method: 'app.passport.growthvip'});
            delete params.type;
        }

        return this.get({data: Object.assign(options, params)});
    }

    getVipRecordDemo(params) {
        let options = {
            method: 'app.inbox.getlistnew'
        };

        return this.get({data: Object.assign(options, params)});
    }

    getCouponsList(uid, type, page, limit) {
        page = page || 1;
        type = type || 'notuse';
        limit = limit || 10;

        let options = {
            method: 'app.coupons.lists',
            uid: uid,
            type: type,
            page: page,
            limit: limit
        };

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