...
|
...
|
@@ -26,9 +26,12 @@ const ptm = { |
|
|
|
|
|
// 领券中心
|
|
|
'/coupon/index': '/coupon/floor?title=领券中心&code=b78b32ed81b18dde8ac84fd33602b88b'
|
|
|
|
|
|
};
|
|
|
|
|
|
const notNeedReferMap = [
|
|
|
/^\/special\/(\d+)_/
|
|
|
];
|
|
|
|
|
|
const genderMap = {
|
|
|
boys: '1,3',
|
|
|
girls: '2,3',
|
...
|
...
|
@@ -47,12 +50,6 @@ module.exports = () => { |
|
|
|
|
|
if (ptm.hasOwnProperty(url)) {
|
|
|
data.mobileRefer = `//${domain}${ptm[url]}`;
|
|
|
} else if (url === '/product/list/index') {
|
|
|
data.mobileRefer = `//list.${domain}`;
|
|
|
} else if (url === '/product/index/brand') {
|
|
|
data.mobileRefer = `//${req.query.domain}.${domain}`;
|
|
|
} else if (url === '/product/search/index') {
|
|
|
data.mobileRefer = `//search.${domain}?${queryString.stringify(req.query)}`;
|
|
|
} else if (url === '/guang/') {
|
|
|
req.query.gender = genderMap[req.query.channel];
|
|
|
_.unset(req.query, 'channel');
|
...
|
...
|
@@ -61,6 +58,12 @@ module.exports = () => { |
|
|
data.mobileRefer = url.replace(proRegNew, `//${domain}/product/$1.html$2`);
|
|
|
}
|
|
|
|
|
|
// 设置不需要跳转页面
|
|
|
req.noRefer = _.find(notNeedReferMap, rule => {
|
|
|
return (_.isRegExp(rule) && rule.test(req.url) ||
|
|
|
(_.isString(rule) && _.isEqual(req.url, rule)));
|
|
|
});
|
|
|
|
|
|
Object.assign(res.locals, data);
|
|
|
}
|
|
|
next();
|
...
|
...
|
|