family.js
2.63 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const family = require('../models/family');
exports.familyIndex = (req, res, next) => {
let uid = req.user.uid;
req.ctx(family).familyIndex(uid).then(result => {
res.render('family/index', {
page: 'family',
title: 'family',
width750: true,
localCss: true,
familyIndexData: result
});
}).catch(next);
};
exports.familyVip = (req, res, next) => {
// let uid = req.user.uid;
req.ctx(family).familyVip().then(result => {
res.json(result);
}).catch(next);
};
exports.coinDetail = (req, res) => {
let responseData = {
module: 'home',
page: 'family-coin',
pageHeader: headerModel.setNav({
navTitle: '积分明细'
}),
title: 'YOHO!积分明细',
width750: true,
localCss: true
};
res.render('family/coin-detail', responseData);
};
exports.getCoinData = (req, res, next) => {
let params = {
uid: req.user.uid,
source: req.query.source,
queryType: req.query.queryType,
beginTime: req.query.beginTime,
endTime: req.query.endTime,
page: req.query.page,
limit: req.query.limit
};
req.ctx(family).getCoinData(params).then(result => {
res.json(result);
}).catch(next);
};
exports.userInfo = (req, res, next) => {
let responseData = {
module: 'home',
page: 'family-userInfo',
pageHeader: headerModel.setNav({
navTitle: '个人信息'
}),
title: 'YOHO!个人信息',
width750: true,
localCss: true
};
let params = {
uid: req.user.uid
};
req.ctx(family).userInfo(params).then(result => {
res.render('family/userInfo', Object.assign(responseData, result));
}).catch(next);
};
exports.modify = (req, res, next) => {
let params = {
uid: req.user.uid,
nickName: req.query.nickName,
gender: req.query.gender,
birthday: req.query.birthday,
height: req.query.height,
weight: req.query.weight
};
req.ctx(family).modify(params).then((result) => {
res.json(result);
}).catch(next);
};
exports.coinMall = (req, res) => {
let responseData = {
module: 'home',
page: 'family-coinMall',
pageHeader: headerModel.setNav({
navTitle: '积分商城'
}),
title: 'YOHO!积分商城',
width750: true,
localCss: true
};
res.render('family/coinMall', Object.assign(responseData, ''));
};