Showing
3 changed files
with
28 additions
and
13 deletions
@@ -155,10 +155,12 @@ exports.grade = (req, res, next) => { | @@ -155,10 +155,12 @@ exports.grade = (req, res, next) => { | ||
155 | pageFooter: true | 155 | pageFooter: true |
156 | }; | 156 | }; |
157 | 157 | ||
158 | - indexModel.getGrade({ | 158 | + let param = { |
159 | uid: req.user.uid, | 159 | uid: req.user.uid, |
160 | channel: req.query.channel || 1 | 160 | channel: req.query.channel || 1 |
161 | - }).then((result) => { | 161 | + }; |
162 | + | ||
163 | + indexModel.getGrade(param).then((result) => { | ||
162 | res.render('vip-grade/vip-grade', Object.assign(result, responseData)); | 164 | res.render('vip-grade/vip-grade', Object.assign(result, responseData)); |
163 | }).catch(next); | 165 | }).catch(next); |
164 | 166 | ||
@@ -185,10 +187,12 @@ exports.preferential = (req, res, next) => { | @@ -185,10 +187,12 @@ exports.preferential = (req, res, next) => { | ||
185 | pageFooter: true | 187 | pageFooter: true |
186 | }; | 188 | }; |
187 | 189 | ||
188 | - indexModel.getPreferential({ | 190 | + let param = { |
189 | uid: req.user.uid, | 191 | uid: req.user.uid, |
190 | channel: req.query.channel || 1 | 192 | channel: req.query.channel || 1 |
191 | - }).then((result) => { | 193 | + }; |
194 | + | ||
195 | + indexModel.getPreferential(param).then((result) => { | ||
192 | res.render('vip-grade/privilege', Object.assign(result, responseData)); | 196 | res.render('vip-grade/privilege', Object.assign(result, responseData)); |
193 | }).catch(next); | 197 | }).catch(next); |
194 | 198 |
@@ -220,7 +220,7 @@ const delRecord = (uid, skn) => { | @@ -220,7 +220,7 @@ const delRecord = (uid, skn) => { | ||
220 | * 会员等级 | 220 | * 会员等级 |
221 | * @param params | 221 | * @param params |
222 | */ | 222 | */ |
223 | -const getGradeGrade = (channel, uid) => { | 223 | +const getGradeGrade = (uid, channel) => { |
224 | return api.get('', { | 224 | return api.get('', { |
225 | method: 'app.passport.vip', | 225 | method: 'app.passport.vip', |
226 | uid: uid, | 226 | uid: uid, |
@@ -228,21 +228,19 @@ const getGradeGrade = (channel, uid) => { | @@ -228,21 +228,19 @@ const getGradeGrade = (channel, uid) => { | ||
228 | }, {code: 200}); | 228 | }, {code: 200}); |
229 | }; | 229 | }; |
230 | 230 | ||
231 | -const getGradeUser = (channel, uid) => { | ||
232 | - if (uid) { | 231 | +const getGradeUser = (uid, channel) => { |
233 | return api.get('', { | 232 | return api.get('', { |
234 | method: 'app.passport.profile', | 233 | method: 'app.passport.profile', |
235 | uid: uid, | 234 | uid: uid, |
236 | channel: channel || 1 | 235 | channel: channel || 1 |
237 | }, {code: 200}); | 236 | }, {code: 200}); |
238 | - } | ||
239 | }; | 237 | }; |
240 | 238 | ||
241 | -const getGrade = (channel, uid) => { | ||
242 | - | 239 | +const getGrade = (param) => { |
240 | + if (param.uid) { | ||
243 | return api.all([ | 241 | return api.all([ |
244 | - getGradeGrade(channel, uid), | ||
245 | - getGradeUser(channel, uid) | 242 | + getGradeGrade(param.uid, param.channel), |
243 | + getGradeUser(param.uid, param.channel) | ||
246 | ]).then((result) => { | 244 | ]).then((result) => { |
247 | 245 | ||
248 | let resu = { | 246 | let resu = { |
@@ -330,6 +328,19 @@ const getGrade = (channel, uid) => { | @@ -330,6 +328,19 @@ const getGrade = (channel, uid) => { | ||
330 | 328 | ||
331 | return resu; | 329 | return resu; |
332 | }); | 330 | }); |
331 | + } else { | ||
332 | + return api.get('', { | ||
333 | + | ||
334 | + }).then(() => { | ||
335 | + | ||
336 | + let resu = { | ||
337 | + vipGrade: [] | ||
338 | + }; | ||
339 | + | ||
340 | + return resu; | ||
341 | + }); | ||
342 | + | ||
343 | + } | ||
333 | }; | 344 | }; |
334 | 345 | ||
335 | /** | 346 | /** |
@@ -49,7 +49,7 @@ router.get('/cancelOrder', orderDetailController.cancelOrder); // 取消订单 | @@ -49,7 +49,7 @@ router.get('/cancelOrder', orderDetailController.cancelOrder); // 取消订单 | ||
49 | router.get('/', homeController.index); // 个人中心首页 | 49 | router.get('/', homeController.index); // 个人中心首页 |
50 | router.get('/mydetails', homeController.myDetails); // 个人基本资料页面 | 50 | router.get('/mydetails', homeController.myDetails); // 个人基本资料页面 |
51 | 51 | ||
52 | -router.get('/grade', homeController.grade); // 会员等级页 | 52 | +router.get('/grade', auth, homeController.grade); // 会员等级页 |
53 | router.get('/privilege', homeController.preferential); // 会员特权列表页 | 53 | router.get('/privilege', homeController.preferential); // 会员特权列表页 |
54 | 54 | ||
55 | router.get('/mycurrency', currencyController.myCurrency); // yoho币总数 | 55 | router.get('/mycurrency', currencyController.myCurrency); // yoho币总数 |
-
Please register or login to post a comment