|
@@ -26,9 +26,12 @@ const ptm = { |
|
@@ -26,9 +26,12 @@ const ptm = { |
26
|
|
26
|
|
27
|
// 领券中心
|
27
|
// 领券中心
|
28
|
'/coupon/index': '/coupon/floor?title=领券中心&code=b78b32ed81b18dde8ac84fd33602b88b'
|
28
|
'/coupon/index': '/coupon/floor?title=领券中心&code=b78b32ed81b18dde8ac84fd33602b88b'
|
29
|
-
|
|
|
30
|
};
|
29
|
};
|
31
|
|
30
|
|
|
|
31
|
+const notNeedReferMap = [
|
|
|
32
|
+ /^\/special\/(\d+)_/
|
|
|
33
|
+];
|
|
|
34
|
+
|
32
|
const genderMap = {
|
35
|
const genderMap = {
|
33
|
boys: '1,3',
|
36
|
boys: '1,3',
|
34
|
girls: '2,3',
|
37
|
girls: '2,3',
|
|
@@ -47,12 +50,6 @@ module.exports = () => { |
|
@@ -47,12 +50,6 @@ module.exports = () => { |
47
|
|
50
|
|
48
|
if (ptm.hasOwnProperty(url)) {
|
51
|
if (ptm.hasOwnProperty(url)) {
|
49
|
data.mobileRefer = `//${domain}${ptm[url]}`;
|
52
|
data.mobileRefer = `//${domain}${ptm[url]}`;
|
50
|
- } else if (url === '/product/list/index') {
|
|
|
51
|
- data.mobileRefer = `//list.${domain}`;
|
|
|
52
|
- } else if (url === '/product/index/brand') {
|
|
|
53
|
- data.mobileRefer = `//${req.query.domain}.${domain}`;
|
|
|
54
|
- } else if (url === '/product/search/index') {
|
|
|
55
|
- data.mobileRefer = `//search.${domain}?${queryString.stringify(req.query)}`;
|
|
|
56
|
} else if (url === '/guang/') {
|
53
|
} else if (url === '/guang/') {
|
57
|
req.query.gender = genderMap[req.query.channel];
|
54
|
req.query.gender = genderMap[req.query.channel];
|
58
|
_.unset(req.query, 'channel');
|
55
|
_.unset(req.query, 'channel');
|
|
@@ -61,6 +58,12 @@ module.exports = () => { |
|
@@ -61,6 +58,12 @@ module.exports = () => { |
61
|
data.mobileRefer = url.replace(proRegNew, `//${domain}/product/$1.html$2`);
|
58
|
data.mobileRefer = url.replace(proRegNew, `//${domain}/product/$1.html$2`);
|
62
|
}
|
59
|
}
|
63
|
|
60
|
|
|
|
61
|
+ // 设置不需要跳转页面
|
|
|
62
|
+ req.noRefer = _.find(notNeedReferMap, rule => {
|
|
|
63
|
+ return (_.isRegExp(rule) && rule.test(req.url) ||
|
|
|
64
|
+ (_.isString(rule) && _.isEqual(req.url, rule)));
|
|
|
65
|
+ });
|
|
|
66
|
+
|
64
|
Object.assign(res.locals, data);
|
67
|
Object.assign(res.locals, data);
|
65
|
}
|
68
|
}
|
66
|
next();
|
69
|
next();
|