Showing
1 changed file
with
9 additions
and
7 deletions
@@ -49,30 +49,32 @@ const shop = { | @@ -49,30 +49,32 @@ const shop = { | ||
49 | let brandId = _.parseInt(stringProcess.paramsFilter(req.query.brand_id)); | 49 | let brandId = _.parseInt(stringProcess.paramsFilter(req.query.brand_id)); |
50 | 50 | ||
51 | co(function* () { | 51 | co(function* () { |
52 | + let params = _.omit(req.query, ['shop_id', 'domain']); | ||
53 | + | ||
52 | if (shopId && domain) { | 54 | if (shopId && domain) { |
53 | - return res.redirect(301, `//m.yohobuy.com/shop/${domain}-${shopId}.html`); | 55 | + return res.redirect(301, helpers.urlFormat(`/shop/${domain}-${shopId}.html`, params)); |
54 | } | 56 | } |
55 | 57 | ||
56 | if (shopId) { | 58 | if (shopId) { |
57 | let shopInfoApi = (yield req.ctx(shopModel).getShopInfo(shopId)) || {}; | 59 | let shopInfoApi = (yield req.ctx(shopModel).getShopInfo(shopId)) || {}; |
58 | 60 | ||
59 | - return res.redirect(301, `//m.yohobuy.com/shop/${_.get(shopInfoApi, 'data.shop_domain', 'id')}-${shopId}.html`); // eslint-disable-line | 61 | + return res.redirect(301, helpers.urlFormat(`/shop/${_.get(shopInfoApi, 'data.shop_domain', 'id')}-${shopId}.html`, params)); // eslint-disable-line |
60 | } | 62 | } |
61 | 63 | ||
62 | if (domain) { | 64 | if (domain) { |
63 | let domainInfo = (yield req.ctx(shopModel).getBrandLogoByDomain(domain)) || {}; // 通过域名查询店铺类型,或者品牌信息 | 65 | let domainInfo = (yield req.ctx(shopModel).getBrandLogoByDomain(domain)) || {}; // 通过域名查询店铺类型,或者品牌信息 |
64 | 66 | ||
65 | if (domainInfo.shopId && domainInfo.type === '2') { | 67 | if (domainInfo.shopId && domainInfo.type === '2') { |
66 | - return res.redirect(301, `//m.yohobuy.com/shop/${domain}-${_.get(domainInfo, 'shopId')}.html`); | 68 | + return res.redirect(301, helpers.urlFormat(`/shop/${domain}-${_.get(domainInfo, 'shopId')}.html`, params)); // eslint-disable-line |
67 | } else { | 69 | } else { |
68 | - return res.redirect(301, helpers.urlFormat('/product/index/brand', { | 70 | + return res.redirect(301, helpers.urlFormat('/product/index/brand', Object.assign(params, { |
69 | brand_id: _.get(domainInfo, 'id') | 71 | brand_id: _.get(domainInfo, 'id') |
70 | - })); | 72 | + }))); |
71 | } | 73 | } |
72 | } | 74 | } |
73 | 75 | ||
74 | if (brandId) { | 76 | if (brandId) { |
75 | - return res.redirect(301, helpers.urlFormat('/product/index/brand', { brand_id: brandId })); | 77 | + return res.redirect(301, helpers.urlFormat('/product/index/brand', Object.assign(params, { brand_id: brandId }))); // eslint-disable-line |
76 | } | 78 | } |
77 | })().catch(next); | 79 | })().catch(next); |
78 | }, | 80 | }, |
@@ -111,7 +113,7 @@ const shop = { | @@ -111,7 +113,7 @@ const shop = { | ||
111 | let apiDomain = _.get(shopInfo, 'shop_domain'); | 113 | let apiDomain = _.get(shopInfo, 'shop_domain'); |
112 | 114 | ||
113 | if (apiDomain && apiDomain !== domain) { | 115 | if (apiDomain && apiDomain !== domain) { |
114 | - return res.redirect(301, `//m.yohobuy.com/shop/${apiDomain}-${shopId}.html`); | 116 | + return res.redirect(301, helpers.urlFormat(`/shop/${apiDomain}-${shopId}.html`, _.omit(req.query, ['shop_id', 'domain']))); // eslint-disable-line |
115 | } | 117 | } |
116 | 118 | ||
117 | // 红人店铺 | 119 | // 红人店铺 |
-
Please register or login to post a comment