Showing
1 changed file
with
2 additions
and
35 deletions
@@ -15,46 +15,13 @@ const moment = require('moment'); | @@ -15,46 +15,13 @@ const moment = require('moment'); | ||
15 | const DEFAULT_AVATAR_ICO = 'http://static.yohobuy.com/images/v3/boy.jpg'; | 15 | const DEFAULT_AVATAR_ICO = 'http://static.yohobuy.com/images/v3/boy.jpg'; |
16 | const _ = require('lodash'); | 16 | const _ = require('lodash'); |
17 | 17 | ||
18 | -const CHANNEL = { | ||
19 | - boys: 'boys', | ||
20 | - girls: 'girls', | ||
21 | - kids: 'kids', | ||
22 | - lifestyle: 'lifestyle' | ||
23 | -}; | ||
24 | - | ||
25 | -const _getChannel = (req, res) => { | ||
26 | - let channel = req.cookies._Channel; | ||
27 | - | ||
28 | - if (!channel) { | ||
29 | - res.cookie('_Channel', CHANNEL.boys, { | ||
30 | - domain: '.yohobuy.com', | ||
31 | - maxAge: moment.duration(300, 'days').seconds() | ||
32 | - }); | ||
33 | - | ||
34 | - channel = 'boys'; // 设置默认值 | ||
35 | - } | ||
36 | - | ||
37 | - return channel; | ||
38 | -}; | ||
39 | - | ||
40 | -const _getGender = (channel) => { | ||
41 | - switch (channel) { | ||
42 | - case 'boys': | ||
43 | - return '1,3'; | ||
44 | - case 'girls': | ||
45 | - return '2,3'; | ||
46 | - default: | ||
47 | - return '1,2,3'; | ||
48 | - } | ||
49 | -}; | ||
50 | - | ||
51 | /** | 18 | /** |
52 | * 首屏渲染商品详情 | 19 | * 首屏渲染商品详情 |
53 | */ | 20 | */ |
54 | const showMain = (req, res, next) => { | 21 | const showMain = (req, res, next) => { |
55 | let pid = req.params[0]; | 22 | let pid = req.params[0]; |
56 | - let channel = _getChannel(req, res); | ||
57 | - let gender = _getGender(channel); | 23 | + let channel = req.yoho.channel; |
24 | + let gender = req.yoho.gender; | ||
58 | 25 | ||
59 | const nullUserInfo = { | 26 | const nullUserInfo = { |
60 | uid: null, | 27 | uid: null, |
-
Please register or login to post a comment