me-gift.js
1.19 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* 个人中心---我的礼品卡
* @author xiaoxiao <xiaoxiao.hao@yoho.cn>
* @date: 2017/9/1
*/
'use strict';
const meGiftService = require('../models/me-gift-service');
/**
* 礼品卡列表
*/
exports.index = (req, res, next) => {
let uid = req.user.uid;
let responseData = {
module: 'home',
page: 'me-gift'
};
req.ctx(meGiftService).getList(req.query, uid).then(result => {
responseData.meGiftPage = true;
Object.assign(responseData, result);
res.render('home/gift/me-gift', responseData);
}).catch(next);
};
/**
* 消费明细
*/
exports.detail = (req, res, next) => {
let uid = req.user.uid;
let responseData = {
module: 'home',
page: 'me-gift'
};
req.ctx(meGiftService).detailList(req.query, uid).then(result => {
responseData.meGiftPage = true;
Object.assign(responseData, result);
res.render('home/gift/me-detail', responseData);
}).catch(next);
};
/**
* 激活礼品卡
*/
exports.activateGift = (req, res, next) => {
let uid = req.user.uid;
req.ctx(meGiftService).activateGift(req.body, uid).then(result => {
res.json(result);
}).catch(next);
};