Authored by htoooth

refactor

@@ -17,14 +17,14 @@ module.exports = [ @@ -17,14 +17,14 @@ module.exports = [
17 return req.path === '/'; 17 return req.path === '/';
18 }, 18 },
19 target: (req) => { 19 target: (req) => {
20 - return helpers.urlFormat('/' + req.query.channel, null, 'guang'); 20 + return helpers.urlFormat(`/${req.query.channel}/`, null, 'guang');
21 } 21 }
22 }, 22 },
23 23
24 // 首页 24 // 首页
25 { 25 {
26 type: TYPE.rewrite, 26 type: TYPE.rewrite,
27 - origin: /^\/(boys|girls|kids|lifestyle)$/, 27 + origin: /^\/(boys|girls|kids|lifestyle)(\/*)$/,
28 target: (req, match, p1) => { 28 target: (req, match, p1) => {
29 req.query.channel = p1; 29 req.query.channel = p1;
30 return `/guang/?chanel=${p1}`; 30 return `/guang/?chanel=${p1}`;
@@ -34,7 +34,7 @@ module.exports = [ @@ -34,7 +34,7 @@ module.exports = [
34 // 首页 + 类型 34 // 首页 + 类型
35 { 35 {
36 type: TYPE.rewrite, 36 type: TYPE.rewrite,
37 - origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)\/$/, 37 + origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)(\/*)$/,
38 target: (req, match, p1, p2) => { 38 target: (req, match, p1, p2) => {
39 req.query.channel = p1; 39 req.query.channel = p1;
40 req.query.type = p2; 40 req.query.type = p2;
@@ -45,7 +45,7 @@ module.exports = [ @@ -45,7 +45,7 @@ module.exports = [
45 // 列表页 + 类型 + 翻页 45 // 列表页 + 类型 + 翻页
46 { 46 {
47 type: TYPE.rewrite, 47 type: TYPE.rewrite,
48 - origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)-p([\d]+)\/$/, 48 + origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)-p([\d]+)(\/*)$/,
49 target: (req, match, p1, p2, p3) => { 49 target: (req, match, p1, p2, p3) => {
50 req.query.channel = p1; 50 req.query.channel = p1;
51 req.query.type = p2; 51 req.query.type = p2;
@@ -57,7 +57,7 @@ module.exports = [ @@ -57,7 +57,7 @@ module.exports = [
57 // 编缉首页 57 // 编缉首页
58 { 58 {
59 type: TYPE.rewrite, 59 type: TYPE.rewrite,
60 - origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)\/$/, 60 + origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)(\/*)$/,
61 target: (req, match, p1, p2) => { 61 target: (req, match, p1, p2) => {
62 req.query.channel = p1; 62 req.query.channel = p1;
63 req.query.author_id = p2; 63 req.query.author_id = p2;
@@ -69,7 +69,7 @@ module.exports = [ @@ -69,7 +69,7 @@ module.exports = [
69 // 编缉首页 + 翻页 69 // 编缉首页 + 翻页
70 { 70 {
71 type: TYPE.rewrite, 71 type: TYPE.rewrite,
72 - origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)-p([\d]+)\/$/, 72 + origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)-p([\d]+)(\/*)$/,
73 target: (req, match, p1, p2, p3) => { 73 target: (req, match, p1, p2, p3) => {
74 req.query.channel = p1; 74 req.query.channel = p1;
75 req.query.author_id = p2; 75 req.query.author_id = p2;