Authored by 陈峰

Merge branch 'hotfix/mobileRefer' into 'gray'

Hotfix/mobile refer

guang首页

See merge request !197
... ... @@ -4,6 +4,7 @@
'use strict';
const _ = require('lodash');
const queryString = require('querystring');
const ptm = {
// 首页
... ... @@ -28,6 +29,13 @@ const ptm = {
};
const genderMap = {
boys: '1,3',
girls: '2,3',
kids: '1,2,3',
lifestyle: '1,2,3'
};
module.exports = () => {
return (req, res, next) => {
let domain = 'm.yohobuy.com';
... ... @@ -44,7 +52,11 @@ module.exports = () => {
} else if (url === '/product/index/brand') {
data.mobileRefer = `//${req.query.domain}.${domain}`;
} else if (url === '/product/search/index') {
data.mobileRefer = `//search.${domain}`;
data.mobileRefer = `//search.${domain}${req.url}`;
} else if (url === '/guang/') {
req.query.gender = genderMap[req.query.channel];
_.unset(req.query, 'channel');
data.mobileRefer = `//${domain}/guang?${queryString.stringify(req.query)}`;
} else if (proRegNew.test(url)) {
data.mobileRefer = url.replace(proRegNew, `//${domain}/product/$1.html$2`);
}
... ...