Authored by 周少峰

old brands redirect

@@ -19,7 +19,7 @@ router.get(/\/(boys|girls|kids|lifestyle)-brands(\/)?$/, @@ -19,7 +19,7 @@ router.get(/\/(boys|girls|kids|lifestyle)-brands(\/)?$/,
19 function(req, res, next) { 19 function(req, res, next) {
20 req.query.channel = req.params[0]; 20 req.query.channel = req.params[0];
21 if (req.query.channel === 'kids') { 21 if (req.query.channel === 'kids') {
22 - req.query.msort =365; 22 + req.query.msort = 365;
23 } 23 }
24 next(); 24 next();
25 }, brandsController.index); 25 }, brandsController.index);
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 4
5 'use strict'; 5 'use strict';
6 6
7 -const _ = require('lodash'); 7 +//const _ = require('lodash');
8 8
9 const helpers = global.yoho.helpers; 9 const helpers = global.yoho.helpers;
10 const TYPE = require('../type'); 10 const TYPE = require('../type');
@@ -32,26 +32,14 @@ module.exports = [ @@ -32,26 +32,14 @@ module.exports = [
32 32
33 { 33 {
34 type: TYPE.redirect, 34 type: TYPE.redirect,
35 - origin: '/brands?gender=1,3&channel=boys',  
36 - target: 'http://www.yohobuy.com/boys-brands/'  
37 - },  
38 -  
39 - {  
40 - type: TYPE.redirect,  
41 - origin: '/brands?gender=2,3&channel=girls',  
42 - target: 'http://www.yohobuy.com/girls-brands/'  
43 - },  
44 -  
45 - {  
46 - type: TYPE.redirect,  
47 - origin: '/brands?msort=365&channel=kids',  
48 - target: 'http://www.yohobuy.com/kids-brands/'  
49 - },  
50 -  
51 - {  
52 - type: TYPE.redirect,  
53 - origin: '/brands?channel=lifestyle',  
54 - target: 'http://www.yohobuy.com/lifestyle-brands/' 35 + origin: /\/brands\?.*channel=(boys|girls|kids|lifestyle)/,
  36 + target: (req) => {
  37 + return helpers.urlFormat(
  38 + `/${req.query.channel}-brands/`,
  39 + null,
  40 + 'www'
  41 + );
  42 + }
55 }, 43 },
56 44
57 { 45 {