Authored by htoooth

refactor

... ... @@ -17,14 +17,14 @@ module.exports = [
return req.path === '/';
},
target: (req) => {
return helpers.urlFormat('/' + req.query.channel, null, 'guang');
return helpers.urlFormat(`/${req.query.channel}/`, null, 'guang');
}
},
// 首页
{
type: TYPE.rewrite,
origin: /^\/(boys|girls|kids|lifestyle)$/,
origin: /^\/(boys|girls|kids|lifestyle)(\/*)$/,
target: (req, match, p1) => {
req.query.channel = p1;
return `/guang/?chanel=${p1}`;
... ... @@ -34,7 +34,7 @@ module.exports = [
// 首页 + 类型
{
type: TYPE.rewrite,
origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)\/$/,
origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)(\/*)$/,
target: (req, match, p1, p2) => {
req.query.channel = p1;
req.query.type = p2;
... ... @@ -45,7 +45,7 @@ module.exports = [
// 列表页 + 类型 + 翻页
{
type: TYPE.rewrite,
origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)-p([\d]+)\/$/,
origin: /^\/(boys|girls|kids|lifestyle)-t([\d]+)-p([\d]+)(\/*)$/,
target: (req, match, p1, p2, p3) => {
req.query.channel = p1;
req.query.type = p2;
... ... @@ -57,7 +57,7 @@ module.exports = [
// 编缉首页
{
type: TYPE.rewrite,
origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)\/$/,
origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)(\/*)$/,
target: (req, match, p1, p2) => {
req.query.channel = p1;
req.query.author_id = p2;
... ... @@ -69,7 +69,7 @@ module.exports = [
// 编缉首页 + 翻页
{
type: TYPE.rewrite,
origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)-p([\d]+)\/$/,
origin: /^\/(boys|girls|kids|lifestyle)-author-i([\d]+)-p([\d]+)(\/*)$/,
target: (req, match, p1, p2, p3) => {
req.query.channel = p1;
req.query.author_id = p2;
... ...