Authored by 陈峰

subDomain增加new转发跳转

@@ -5,13 +5,19 @@ @@ -5,13 +5,19 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
  8 +const helpers = global.yoho.helpers;
  9 +
8 module.exports = () => { 10 module.exports = () => {
9 return (req, res, next) => { 11 return (req, res, next) => {
10 - console.log(req.subdomains)  
11 if (req.subdomains.length) { 12 if (req.subdomains.length) {
12 switch (req.subdomains[0]) { 13 switch (req.subdomains[0]) {
13 case 'guang': // 逛 14 case 'guang': // 逛
  15 + req.url = req.url.replace('/guang', '');
  16 + req.url = `/guang${req.url}`;
14 break; 17 break;
  18 + case 'new':
  19 + res.redirect(helpers.urlFormat(req.path, req.query, 'default'));
  20 + return;
15 default: // 其它(识别为品牌) 21 default: // 其它(识别为品牌)
16 req.url = `/product/brand/${req.subdomains[0]}`; 22 req.url = `/product/brand/${req.subdomains[0]}`;
17 break; 23 break;