Showing
6 changed files
with
87 additions
and
35 deletions
@@ -2,6 +2,12 @@ | @@ -2,6 +2,12 @@ | ||
2 | 2 | ||
3 | const mayLikeModel = require('../models/recom'); | 3 | const mayLikeModel = require('../models/recom'); |
4 | 4 | ||
5 | +let yhChannel = { | ||
6 | + boys: 1, | ||
7 | + girl: 2, | ||
8 | + kids: 3 | ||
9 | +}; | ||
10 | + | ||
5 | /** | 11 | /** |
6 | * 你可能喜欢的BOYS或GIRLS的商品列表 | 12 | * 你可能喜欢的BOYS或GIRLS的商品列表 |
7 | */ | 13 | */ |
@@ -12,10 +18,9 @@ const mayLike = (req, res, next) => { | @@ -12,10 +18,9 @@ const mayLike = (req, res, next) => { | ||
12 | let limit = 50; | 18 | let limit = 50; |
13 | let gender = req.query.gender; | 19 | let gender = req.query.gender; |
14 | let udid = req.sessionID || 'yoho'; | 20 | let udid = req.sessionID || 'yoho'; |
15 | - let recPos = 100009; | ||
16 | - let channel = req.query.channel || 1; | 21 | + let recPos = req.query.rec_pos || 100001; |
22 | + let channel = req.cookies._Channel && yhChannel[req.cookies._Channel] || 1; | ||
17 | 23 | ||
18 | - if (channel === 1 || channel === 2) { | ||
19 | return mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => { | 24 | return mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => { |
20 | 25 | ||
21 | res.render('recom/maybe-like', Object.assign({ | 26 | res.render('recom/maybe-like', Object.assign({ |
@@ -23,16 +28,6 @@ const mayLike = (req, res, next) => { | @@ -23,16 +28,6 @@ const mayLike = (req, res, next) => { | ||
23 | goods: result | 28 | goods: result |
24 | }, result)); | 29 | }, result)); |
25 | }).catch(next); | 30 | }).catch(next); |
26 | - } | ||
27 | - | ||
28 | - recPos = 100001; | ||
29 | - | ||
30 | - mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => { | ||
31 | - res.render('recom/maybe-like', { | ||
32 | - layout: false, | ||
33 | - goods: result | ||
34 | - }); | ||
35 | - }).catch(next); | ||
36 | }; | 31 | }; |
37 | 32 | ||
38 | /** | 33 | /** |
@@ -52,7 +47,25 @@ const mayLikeKids = (req, res, next) => { | @@ -52,7 +47,25 @@ const mayLikeKids = (req, res, next) => { | ||
52 | }).catch(next); | 47 | }).catch(next); |
53 | }; | 48 | }; |
54 | 49 | ||
50 | +const mayLikelife = (req, res, next) => { | ||
51 | + let page = req.query.page || 1; | ||
52 | + let limit = 50; | ||
53 | + | ||
54 | + if (page > 1) { | ||
55 | + return; | ||
56 | + } | ||
57 | + | ||
58 | + mayLikeModel.mayLikelife(page, limit).then((result) => { | ||
59 | + | ||
60 | + res.render('recom/maybe-like-lifestyle', { | ||
61 | + layout: false, | ||
62 | + goodsContainer: result.goodsContainer | ||
63 | + }); | ||
64 | + }).catch(next); | ||
65 | +}; | ||
66 | + | ||
55 | module.exports = { | 67 | module.exports = { |
56 | mayLike, | 68 | mayLike, |
57 | - mayLikeKids | 69 | + mayLikeKids, |
70 | + mayLikelife | ||
58 | }; | 71 | }; |
@@ -59,7 +59,48 @@ const mayLikeKids = (page, limit, channel) => { | @@ -59,7 +59,48 @@ const mayLikeKids = (page, limit, channel) => { | ||
59 | }); | 59 | }); |
60 | }; | 60 | }; |
61 | 61 | ||
62 | +const mayLikelife = (page, limit, channel) => { | ||
63 | + return api.get('', { | ||
64 | + method: 'app.search.lifeStyle', | ||
65 | + page: page, | ||
66 | + limit: limit, | ||
67 | + yh_channel: '4' | ||
68 | + }).then((result) => { | ||
69 | + if (result && result.code === 200) { | ||
70 | + let formData = { | ||
71 | + goodsContainer: [] | ||
72 | + }; | ||
73 | + | ||
74 | + if (result.data.product_list.top) { | ||
75 | + let build = {}; | ||
76 | + | ||
77 | + build.show = true; | ||
78 | + | ||
79 | + build.goods = productProcess.processProductList(result.data.product_list.top, {showTags: false}); | ||
80 | + | ||
81 | + formData.goodsContainer.push(build); | ||
82 | + } | ||
83 | + | ||
84 | + if (result.data.product_list.top) { | ||
85 | + let build = {}; | ||
86 | + | ||
87 | + build.show = true; | ||
88 | + | ||
89 | + build.goods = productProcess.processProductList(result.data.product_list.new, {showTags: false}); | ||
90 | + | ||
91 | + formData.goodsContainer.push(build); | ||
92 | + } | ||
93 | + // console.log(formData) | ||
94 | + return formData; | ||
95 | + | ||
96 | + } else { | ||
97 | + logger.error('mayLikelife code no 200'); | ||
98 | + } | ||
99 | + }); | ||
100 | +}; | ||
101 | + | ||
62 | module.exports = { | 102 | module.exports = { |
63 | mayLike, | 103 | mayLike, |
64 | - mayLikeKids | 104 | + mayLikeKids, |
105 | + mayLikelife | ||
65 | }; | 106 | }; |
@@ -74,6 +74,7 @@ router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品 | @@ -74,6 +74,7 @@ router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品 | ||
74 | 74 | ||
75 | router.get('/recom/maylike', recom.mayLike); // 你可能喜欢 | 75 | router.get('/recom/maylike', recom.mayLike); // 你可能喜欢 |
76 | router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢 | 76 | router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢 |
77 | +router.get('/recom/maylikelife', recom.mayLikelife); // 创意生活你可能喜欢 | ||
77 | 78 | ||
78 | router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口 | 79 | router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口 |
79 | 80 |
1 | -<div class="maybe-like"> | ||
2 | - <ul id="maybe-like-nav" class="maybe-like-nav clearfix"> | ||
3 | - <li class="maybe-like-nav-item focus">新品到着</li> | ||
4 | - <li class="maybe-like-nav-item">人气单品</li> | ||
5 | - </ul> | ||
6 | - | ||
7 | - <div id="goods-list"> | ||
8 | - {{# goodsContainer}} | 1 | +{{# goodsContainer}} |
9 | <div class="goods-list {{^show}}hide{{/show}}"> | 2 | <div class="goods-list {{^show}}hide{{/show}}"> |
10 | {{# goods}} | 3 | {{# goods}} |
11 | - {{> goods}} | 4 | + {{> common/goods}} |
12 | {{/ goods}} | 5 | {{/ goods}} |
13 | </div> | 6 | </div> |
14 | - {{/ goodsContainer}} | ||
15 | - </div> | ||
16 | - | ||
17 | - <div id="load-more-info" class="load-more-info"> | ||
18 | - <div class="loading status hide"> | ||
19 | - 正在加载... | ||
20 | - </div> | ||
21 | - <span class="no-more status hide">没有更多啦</span> | ||
22 | - </div> | ||
23 | -</div> | ||
7 | +{{/ goodsContainer}} |
@@ -28,6 +28,19 @@ module.exports = { | @@ -28,6 +28,19 @@ module.exports = { | ||
28 | // service: 'http://service.yoho.cn/', | 28 | // service: 'http://service.yoho.cn/', |
29 | // liveApi: 'http://api.live.yoho.cn/', | 29 | // liveApi: 'http://api.live.yoho.cn/', |
30 | // singleApi: 'http://single.yoho.cn/' | 30 | // singleApi: 'http://single.yoho.cn/' |
31 | + | ||
32 | + api: 'http://api-test3.yohops.com:9999/', | ||
33 | + service: 'http://service-test3.yohops.com:9999/', | ||
34 | + liveApi: 'http://testapi.live.yohops.com:9999/', | ||
35 | + singleApi: 'http://api-test3.yohops.com:9999/' | ||
36 | + | ||
37 | + // favApi: 'http://192.168.102.31:8092/brower', | ||
38 | + // api: 'http://192.168.102.205:8080/gateway/', | ||
39 | + // service: 'http://192.168.102.205:8080/gateway/', | ||
40 | + // search: 'http://192.168.102.216:8080/yohosearch/' | ||
41 | + | ||
42 | + // api: 'http://api.yoho.yohoops.org/', | ||
43 | + // service: 'http://service.yoho.yohoops.org/', | ||
31 | }, | 44 | }, |
32 | subDomains: { | 45 | subDomains: { |
33 | host: '.m.yohobuy.com', | 46 | host: '.m.yohobuy.com', |
-
Please register or login to post a comment