Showing
3 changed files
with
67 additions
and
58 deletions
@@ -6,38 +6,39 @@ | @@ -6,38 +6,39 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | -// const indexModel = require('../models/index'); | 9 | +const indexModel = require('../models/index'); |
10 | 10 | ||
11 | exports.index = (req, res, next) => { | 11 | exports.index = (req, res, next) => { |
12 | let params = { | 12 | let params = { |
13 | - uid: req.user.uid || '' | 13 | + uid: req.user.uid || '6228593' |
14 | }; | 14 | }; |
15 | 15 | ||
16 | - // indexModel.index(params).then(result => { | ||
17 | - // if (result) { | ||
18 | - // res.render('index', result); | ||
19 | - // } | ||
20 | - // }).catch(next); | 16 | + indexModel.index(params).then(result => { |
17 | + if (result) { | ||
18 | + console.log(result); | ||
19 | + res.render('index', result); | ||
20 | + } | ||
21 | + }).catch(next); | ||
21 | 22 | ||
22 | - res.render('index', { | ||
23 | - myIndexPage: 1, | ||
24 | - showDownloadApp: 1, | ||
25 | - navHome: 1, | ||
26 | - notice: [], | ||
27 | - pageFooter: 1, | ||
28 | - cartUrl: '//m.dev.yohobuy.com/cart/index/index', | ||
29 | - signinUrl: '//m.dev.yohobuy.com/signin.html?refer=%2F%2Fm.dev.yohobuy.com%2Fhome', | ||
30 | - isLogin: 1, | ||
31 | - wait_pay_num: 0, | ||
32 | - wait_cargo_num: 0, | ||
33 | - send_cargo_num: 0, | ||
34 | - brand_favorite_total: 0, | ||
35 | - product_favorite_total: 0, | ||
36 | - inbox_total: 0, | ||
37 | - comment_total: 0, | ||
38 | - refund_exchange_num: 0, | ||
39 | - yoho_coin_num: 0, | ||
40 | - coupon_num: 0, | ||
41 | - product_browse: 0 | ||
42 | - }); | 23 | + // res.render('index', { |
24 | + // myIndexPage: 1, | ||
25 | + // showDownloadApp: 1, | ||
26 | + // navHome: 1, | ||
27 | + // notice: [], | ||
28 | + // pageFooter: 1, | ||
29 | + // cartUrl: '//m.dev.yohobuy.com/cart/index/index', | ||
30 | + // signinUrl: '//m.dev.yohobuy.com/signin.html?refer=%2F%2Fm.dev.yohobuy.com%2Fhome', | ||
31 | + // isLogin: 1, | ||
32 | + // wait_pay_num: 0, | ||
33 | + // wait_cargo_num: 0, | ||
34 | + // send_cargo_num: 0, | ||
35 | + // brand_favorite_total: 0, | ||
36 | + // product_favorite_total: 0, | ||
37 | + // inbox_total: 0, | ||
38 | + // comment_total: 0, | ||
39 | + // refund_exchange_num: 0, | ||
40 | + // yoho_coin_num: 0, | ||
41 | + // coupon_num: 0, | ||
42 | + // product_browse: 0 | ||
43 | + // }); | ||
43 | }; | 44 | }; |
@@ -12,18 +12,12 @@ const favApi = global.yoho.FavAPI; | @@ -12,18 +12,12 @@ const favApi = global.yoho.FavAPI; | ||
12 | const api = global.yoho.API; | 12 | const api = global.yoho.API; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * 收藏数量接口 | ||
16 | - * @param params | ||
17 | - * @returns {*|Promise.<TResult>} | 15 | + * 个人详情数据 |
18 | */ | 16 | */ |
19 | -const _favoriteData = (params) => { | ||
20 | - return favApi.get('brower', { | ||
21 | - method: 'app.favorite.getFavoriteCount', | ||
22 | - uid: params.uid || '8039759' | ||
23 | - }, {code: 200, cache: false}).then(result => { | ||
24 | - if (result.data) { | ||
25 | - return result; | ||
26 | - } | 17 | +const _userData = (params) => { |
18 | + return api.get('', { | ||
19 | + method: 'app.passport.profile', | ||
20 | + uid: params.uid, | ||
27 | }); | 21 | }); |
28 | }; | 22 | }; |
29 | 23 | ||
@@ -33,44 +27,54 @@ const _favoriteData = (params) => { | @@ -33,44 +27,54 @@ const _favoriteData = (params) => { | ||
33 | const _noticeData = () => { | 27 | const _noticeData = () => { |
34 | return api.get('', { | 28 | return api.get('', { |
35 | method: 'app.resources.getNotices', | 29 | method: 'app.resources.getNotices', |
36 | - }).then(result => { | ||
37 | - return result; | ||
38 | }); | 30 | }); |
39 | }; | 31 | }; |
40 | 32 | ||
41 | /** | 33 | /** |
42 | - * 个人中心页面优惠券,收藏的商品等的数目数据 | 34 | + * 收藏数量接口 |
35 | + * @param params | ||
36 | + * @returns {*|Promise.<TResult>} | ||
43 | */ | 37 | */ |
44 | -const _infoNum = (params) => { | ||
45 | - return api.get('', { | ||
46 | - method: 'app.home.getInfoNum', | ||
47 | - uid: params.uid, | ||
48 | - udid: params.udid, | ||
49 | - }).then(result => { | ||
50 | - return result; | 38 | +const _favoriteData = (params) => { |
39 | + return favApi.get('brower', { | ||
40 | + method: 'app.favorite.getFavoriteCount', | ||
41 | + uid: params.uid || '8039759' | ||
51 | }); | 42 | }); |
52 | }; | 43 | }; |
53 | 44 | ||
54 | /** | 45 | /** |
55 | - * 个人详情数据 | 46 | + * 个人中心页面优惠券,收藏的商品等的数目数据 |
56 | */ | 47 | */ |
57 | -const _userData = (params) => { | 48 | +const _infoNum = (params) => { |
58 | return api.get('', { | 49 | return api.get('', { |
59 | - method: 'app.passport.profile', | 50 | + method: 'app.home.getInfoNum', |
60 | uid: params.uid, | 51 | uid: params.uid, |
61 | - }).then(result => { | ||
62 | - return result; | ||
63 | - }); | 52 | + udid: params.udid, |
53 | + }, {code: 200}); | ||
64 | }; | 54 | }; |
65 | 55 | ||
66 | - | ||
67 | /** | 56 | /** |
68 | * 个人中心首页 | 57 | * 个人中心首页 |
69 | * @param params | 58 | * @param params |
70 | * @returns {function()} | 59 | * @returns {function()} |
71 | */ | 60 | */ |
72 | const index = (params) => { | 61 | const index = (params) => { |
73 | - return _favoriteData; | 62 | + let finalResult = {}; |
63 | + | ||
64 | + return api.all([ | ||
65 | + _userData(params), | ||
66 | + _noticeData(), | ||
67 | + _favoriteData(params) | ||
68 | + ]).then(result => { | ||
69 | + // console.log(result); | ||
70 | + | ||
71 | + if (result[2] && result[2].data) { | ||
72 | + Object.assign(finalResult, { | ||
73 | + product_favorite_total: result[2].data.product_favorite_total | ||
74 | + }); | ||
75 | + } | ||
76 | + return finalResult; | ||
77 | + }); | ||
74 | }; | 78 | }; |
75 | 79 | ||
76 | module.exports = { | 80 | module.exports = { |
@@ -16,10 +16,14 @@ module.exports = { | @@ -16,10 +16,14 @@ module.exports = { | ||
16 | siteUrl: '//m.yohobuy.com', | 16 | siteUrl: '//m.yohobuy.com', |
17 | domains: { | 17 | domains: { |
18 | // api: 'http://devapi.yoho.cn:58078/', | 18 | // api: 'http://devapi.yoho.cn:58078/', |
19 | - // service: 'http://devservice.yoho.cn:58077/' | 19 | + // service: 'http://devservice.yoho.cn:58077/', |
20 | + | ||
21 | + // api: 'http://api.yoho.yohoops.org/', | ||
22 | + // service: 'http://service.yoho.yohoops.org/', | ||
20 | 23 | ||
21 | api: 'http://testapi.yoho.cn:28078/', | 24 | api: 'http://testapi.yoho.cn:28078/', |
22 | service: 'http://testservice.yoho.cn:28077/', | 25 | service: 'http://testservice.yoho.cn:28077/', |
26 | + | ||
23 | favApi: 'http://192.168.102.31:8092/' | 27 | favApi: 'http://192.168.102.31:8092/' |
24 | }, | 28 | }, |
25 | subDomains: { | 29 | subDomains: { |
-
Please register or login to post a comment