...
|
...
|
@@ -27,30 +27,39 @@ const shop = { |
|
|
brand_id: brandId,
|
|
|
domain
|
|
|
} = req.query;
|
|
|
const uid = req.user.uid;
|
|
|
|
|
|
req.shopInfo = {};
|
|
|
|
|
|
if (brandId) {
|
|
|
return shop.brand(req, res, next); // 品牌列表,有品牌ID就直接展示为品牌
|
|
|
}
|
|
|
|
|
|
return co(function*() {
|
|
|
let shopInfo = {};
|
|
|
|
|
|
if (shopId) {
|
|
|
shopInfo = (yield listModel.getShopInfo(shopId, req.user.uid)) || {}; // 通过店铺 ID 查询店铺类型
|
|
|
let shopInfo = (yield listModel.getShopInfo(shopId, uid)) || {};
|
|
|
|
|
|
req.shopInfo = _.assign(shopInfo, {shopId: shopId}); // 通过店铺 ID 查询店铺类型
|
|
|
} else if (domain) {
|
|
|
shopInfo = (yield listModel.getBrandLogoByDomain(domain)) || {}; // 通过域名查询店铺类型,或者品牌信息
|
|
|
}
|
|
|
let domainInfo = (yield listModel.getBrandLogoByDomain(domain)) || {}; // 通过域名查询店铺类型,或者品牌信息
|
|
|
|
|
|
if (domainInfo.shopId && domainInfo.type === '2') {
|
|
|
let shopInfo = yield listModel.getShopInfo(domainInfo.shopId, uid);
|
|
|
|
|
|
req.shopInfo = shopInfo;
|
|
|
_.assign(req.shopInfo, domainInfo, shopInfo);
|
|
|
} else {
|
|
|
req.shopInfo = domainInfo;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (shopInfo.is_red_shop) {
|
|
|
return shop.redShop(req, res, next); // 红人店铺
|
|
|
} else if (shopInfo.id) {
|
|
|
return shop.brand(req, res, next); // 品牌或者商品列表
|
|
|
} else if (shopId) { // 没有店铺但是有 shopId 的商品列表
|
|
|
if (req.shopInfo.shopId) { // 店铺
|
|
|
return shop.redShop(req, res, next);
|
|
|
} else if (req.shopInfo.id) { // 品牌,id 来自 domainInfo
|
|
|
return shop.brand(req, res, next);
|
|
|
} else if (shopId) { // 没有查到店铺数据但是有 shopId 的请求
|
|
|
return shop.list(req, res, next);
|
|
|
} else {
|
|
|
return res.redirect('/?go=1');
|
|
|
} else { // 什么都没有,去首页
|
|
|
return res.redirect(helpers.urlFormat('', {go: '-1'}));
|
|
|
}
|
|
|
})().catch(next);
|
|
|
},
|
...
|
...
|
@@ -141,7 +150,7 @@ const shop = { |
|
|
* 红人店铺
|
|
|
*/
|
|
|
redShop(req, res, next) {
|
|
|
let shopId = req.query.shop_id; // test3 792
|
|
|
let shopId = req.shopInfo.shopId; // test3 792
|
|
|
let channel = req.yoho.channel || 'boys';
|
|
|
let uid = req.user.uid || 0;
|
|
|
let udid = req.sessionID || 'yoho';
|
...
|
...
|
|