Authored by 周少峰

Merge branch 'feature/seoUrl' of git.yoho.cn:fe/yohobuy-node into feature/seoUrl

@@ -8,12 +8,14 @@ const cachePage = { @@ -8,12 +8,14 @@ const cachePage = {
8 8
9 // 频道页 9 // 频道页
10 '/': 30 * SECOND, 10 '/': 30 * SECOND,
11 - '/woman': 30 * SECOND,  
12 - '/kids': 30 * SECOND,  
13 - '/lifestyle': 30 * SECOND, 11 + '/woman/': 30 * SECOND,
  12 + '/girls/': 30 * SECOND,
  13 + '/kids/': 30 * SECOND,
  14 + '/lifestyle/': 30 * SECOND,
14 15
15 // 商品详情页 16 // 商品详情页
16 - '/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/': 30 * MINUTE, 17 + //'/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/': 30 * MINUTE,
  18 + '/product/\\/p([\\d]+)(.*)/': 30 * MINUTE,
17 19
18 // 逛 20 // 逛
19 '/guang/': 1 * MINUTE, 21 '/guang/': 1 * MINUTE,
@@ -7,7 +7,7 @@ module.exports = () => { @@ -7,7 +7,7 @@ module.exports = () => {
7 let isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('user-agent')); // eslint-disable-line 7 let isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('user-agent')); // eslint-disable-line
8 8
9 if (isMobile) { 9 if (isMobile) {
10 - req.url = req.url.replace(/^\/p([\d]+).html(.*)/, '/product/pro_$1_1/1.html$2'); 10 + req.url = req.url.replace(/^\/product\/p([\d]+).html(.*)/, '/product/pro_$1_1/1.html$2');
11 return res.redirect(`//m.yohobuy.com${req.url}`); 11 return res.redirect(`//m.yohobuy.com${req.url}`);
12 } 12 }
13 13
@@ -57,7 +57,7 @@ module.exports = () => { @@ -57,7 +57,7 @@ module.exports = () => {
57 } else if (url === '/guang/Index/editor') { 57 } else if (url === '/guang/Index/editor') {
58 data.mobileRefer += `/author/index?id=${req.query.author_id}`; 58 data.mobileRefer += `/author/index?id=${req.query.author_id}`;
59 } 59 }
60 - } else if (proRegNew.text(url)) { 60 + } else if (proRegNew.test(url)) {
61 data.mobileRefer = url.replace(proRegNew, `//${domain}/product/pro_$1_1/1.html$2`); 61 data.mobileRefer = url.replace(proRegNew, `//${domain}/product/pro_$1_1/1.html$2`);
62 } 62 }
63 63