gift.js
889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* 个人中心---兑换礼品卡
* @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 uid = req.user.uid;
let responseData = {
module: 'home',
page: 'gift'
};
// 真实数据输出
giftService.index(req.query, uid).then(result => {
responseData.meGiftPage = true;
Object.assign(responseData, result);
res.render('gift', responseData);
}).catch(next);
};
/**
* 个人中心-兑换礼品卡提交返回信息
*/
exports.exchange = (req, res, next) => {
let uid = req.user.uid;
// 真实数据输出
giftService.exchange(req, req.body, uid).then(result => {
res.json(result);
}).catch(next);
};