gift.js 976 Bytes
/**
 * 个人中心---兑换礼品卡
 * @author gaohongwei <hongwei.gao@yoho.cn>
 * @date: 2016/9/7
 */
'use strict';

const mRoot = '../models';
const giftService = require(`${mRoot}/gift-service`); // user  model

/**
 * 礼品卡页面
 */
 exports.index = (req, res, next) => {
    let channel = req.query.channel || req.cookies._Channel || 'boys';

    let responseData = {
        module: 'home',
        page: 'gift'
    };

    let uid = '20001048';

    // 真实数据输出
    giftService.index(req.query, uid, channel).then(result => {
        responseData.meGiftPage = true;
        Object.assign(responseData, result);
        res.render('home/gift/gift', responseData);
    }).catch(next);
};

/**
 * 个人中心-兑换礼品卡提交返回信息
 */
exports.exchange = (req, res, next) => {
    let uid = '20001048';
    
    // 真实数据输出
    giftService.exchange(req.body, uid).then(result => {
        res.json(result);
    }).catch(next);
};