family.js
4.7 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const family = require('../models/family');
exports.familyIndex = (req, res, next) => {
let uid = req.user.uid;
let contentCodeOne = '486e6adc7c83001b2e9e83996438fab8';
let contentCodeTwo = 'eebbcc60607ac443922d8fabe44eb222';
let isMarsApp = req.yoho.isMarsApp;
let protocol = req.protocol;
req.ctx(family).familyIndex(uid, contentCodeOne, contentCodeTwo, isMarsApp, protocol).then(result => {
res.render('family/index', {
page: 'family',
title: 'YOHO!Family',
width750: true,
localCss: true,
familyIndexData: result
});
}).catch(next);
};
exports.integralCharts = (req, res, next) => {
let uid = req.user.uid;
req.ctx(family).integralCharts(uid).then(result => {
res.json(result);
}).catch(next);
};
exports.familyVip = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let uid = req.user.uid;
let yohoApp = req.yoho.isYohoApp;
let marsApp = req.yoho.isMarsApp;
req.ctx(family).familyVip(udid, uid, yohoApp, marsApp).then(result => {
res.json(result);
}).catch(next);
};
exports.downLoadData = (req, res, next) => {
let codeArr = req.query.codeArr;
let isApp = req.yoho.isApp;
if (!codeArr) {
return;
}
req.ctx(family).downLoadData(codeArr, isApp).then(result => {
res.json(result);
}).catch(next);
};
// 设置潮流口令
exports.setTrendWord = (req, res, next) => {
let uid = req.user.uid;
let trendWord = req.query.trendWord;
req.ctx(family).setTrendWord(uid, trendWord).then(result => {
res.json(result);
}).catch(next);
};
exports.coinDetail = (req, res) => {
let responseData = {
module: 'home',
page: 'family-coin',
pageHeader: headerModel.setNav({
navTitle: '积分明细'
}),
title: '积分明细',
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: '个人信息',
width750: true,
localCss: true
};
let params = {
uid: req.user.uid,
isYohoApp: req.yoho.isYohoApp,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp
};
req.ctx(family).userInfo(params).then(result => {
res.render('family/user-info', 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,
province: req.query.province,
city: req.query.city
};
req.ctx(family).modify(params).then((result) => {
res.json(result);
}).catch(next);
};
exports.getCity = (req, res, next) => {
let params = {
uid: req.user.uid,
id: req.query.id
};
req.ctx(family).getCity(params).then((result) => {
res.json(result);
}).catch(next);
};
exports.coinMall = (req, res, next) => {
let responseData = {
module: 'home',
page: 'family-coinMall',
pageHeader: headerModel.setNav({
navTitle: '积分商城'
}),
title: '积分商城',
width750: true,
localCss: true
};
let params = {
uid: req.user.uid,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp
};
req.ctx(family).coinMall(params).then(result => {
res.render('family/coin-mall', Object.assign(responseData, result));
}).catch(next);
};
exports.getList = (req, res, next) => {
let params = {
uid: req.user.uid,
type: req.query.type,
page: req.query.page,
limit: req.query.limit,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp,
cityId: req.cookies.app_city_id || 0
};
req.ctx(family).getList(params).then((result) => {
res.json(result);
}).catch(next);
};