...
|
...
|
@@ -15,46 +15,13 @@ const moment = require('moment'); |
|
|
const DEFAULT_AVATAR_ICO = 'http://static.yohobuy.com/images/v3/boy.jpg';
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const CHANNEL = {
|
|
|
boys: 'boys',
|
|
|
girls: 'girls',
|
|
|
kids: 'kids',
|
|
|
lifestyle: 'lifestyle'
|
|
|
};
|
|
|
|
|
|
const _getChannel = (req, res) => {
|
|
|
let channel = req.cookies._Channel;
|
|
|
|
|
|
if (!channel) {
|
|
|
res.cookie('_Channel', CHANNEL.boys, {
|
|
|
domain: '.yohobuy.com',
|
|
|
maxAge: moment.duration(300, 'days').seconds()
|
|
|
});
|
|
|
|
|
|
channel = 'boys'; // 设置默认值
|
|
|
}
|
|
|
|
|
|
return channel;
|
|
|
};
|
|
|
|
|
|
const _getGender = (channel) => {
|
|
|
switch (channel) {
|
|
|
case 'boys':
|
|
|
return '1,3';
|
|
|
case 'girls':
|
|
|
return '2,3';
|
|
|
default:
|
|
|
return '1,2,3';
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 首屏渲染商品详情
|
|
|
*/
|
|
|
const showMain = (req, res, next) => {
|
|
|
let pid = req.params[0];
|
|
|
let channel = _getChannel(req, res);
|
|
|
let gender = _getGender(channel);
|
|
|
let channel = req.yoho.channel;
|
|
|
let gender = req.yoho.gender;
|
|
|
|
|
|
const nullUserInfo = {
|
|
|
uid: null,
|
...
|
...
|
|