...
|
...
|
@@ -49,30 +49,32 @@ const shop = { |
|
|
let brandId = _.parseInt(stringProcess.paramsFilter(req.query.brand_id));
|
|
|
|
|
|
co(function* () {
|
|
|
let params = _.omit(req.query, ['shop_id', 'domain']);
|
|
|
|
|
|
if (shopId && domain) {
|
|
|
return res.redirect(301, `//m.yohobuy.com/shop/${domain}-${shopId}.html`);
|
|
|
return res.redirect(301, helpers.urlFormat(`/shop/${domain}-${shopId}.html`, params));
|
|
|
}
|
|
|
|
|
|
if (shopId) {
|
|
|
let shopInfoApi = (yield req.ctx(shopModel).getShopInfo(shopId)) || {};
|
|
|
|
|
|
return res.redirect(301, `//m.yohobuy.com/shop/${_.get(shopInfoApi, 'data.shop_domain', 'id')}-${shopId}.html`); // eslint-disable-line
|
|
|
return res.redirect(301, helpers.urlFormat(`/shop/${_.get(shopInfoApi, 'data.shop_domain', 'id')}-${shopId}.html`, params)); // eslint-disable-line
|
|
|
}
|
|
|
|
|
|
if (domain) {
|
|
|
let domainInfo = (yield req.ctx(shopModel).getBrandLogoByDomain(domain)) || {}; // 通过域名查询店铺类型,或者品牌信息
|
|
|
|
|
|
if (domainInfo.shopId && domainInfo.type === '2') {
|
|
|
return res.redirect(301, `//m.yohobuy.com/shop/${domain}-${_.get(domainInfo, 'shopId')}.html`);
|
|
|
return res.redirect(301, helpers.urlFormat(`/shop/${domain}-${_.get(domainInfo, 'shopId')}.html`, params)); // eslint-disable-line
|
|
|
} else {
|
|
|
return res.redirect(301, helpers.urlFormat('/product/index/brand', {
|
|
|
return res.redirect(301, helpers.urlFormat('/product/index/brand', Object.assign(params, {
|
|
|
brand_id: _.get(domainInfo, 'id')
|
|
|
}));
|
|
|
})));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (brandId) {
|
|
|
return res.redirect(301, helpers.urlFormat('/product/index/brand', { brand_id: brandId }));
|
|
|
return res.redirect(301, helpers.urlFormat('/product/index/brand', Object.assign(params, { brand_id: brandId }))); // eslint-disable-line
|
|
|
}
|
|
|
})().catch(next);
|
|
|
},
|
...
|
...
|
@@ -111,7 +113,7 @@ const shop = { |
|
|
let apiDomain = _.get(shopInfo, 'shop_domain');
|
|
|
|
|
|
if (apiDomain && apiDomain !== domain) {
|
|
|
return res.redirect(301, `//m.yohobuy.com/shop/${apiDomain}-${shopId}.html`);
|
|
|
return res.redirect(301, helpers.urlFormat(`/shop/${apiDomain}-${shopId}.html`, _.omit(req.query, ['shop_id', 'domain']))); // eslint-disable-line
|
|
|
}
|
|
|
|
|
|
// 红人店铺
|
...
|
...
|
|