seckill.js 1.36 KB
/**
 * 秒杀models
 * @author: 陈峰<feng.chen@yoho.cn>
 * @date: 2016/9/18
 */

'use strict';

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

    /**
     * [获取秒杀时间栏接口]
     * @return {[object]}
     */
    queryActivity() {
        return this.get({
            data: {
                method: 'app.seckill.queryActivity'
            }
        });
    }

    /**
     * [获取指定秒杀活动商品列表接口]
     * @param  {[int]} activityId [秒杀活动id]
     * @param  {[int]} uid  only app use
     * @return {[object]}
     */
    queryProductList(activityId) {
        return this.get({
            data: {
                method: 'app.seckill.queryProductList',
                activityId: activityId
            }
        });
    }

    /**
     *   获取提醒 列表
     */
    queryRemindList(activityId, uid) {
        return this.get({
            data: {
                method: 'app.seckill.queryRemindList',
                activityId,
                uid
            }
        });
    }

    /**
     * 设置提醒
     */
    remind(options) {
        let formData = Object.assign({
            method: !options.on_off ? 'app.seckill.cancelUserReminder' : 'app.seckill.addUserReminder',
        }, options);

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