...
|
...
|
@@ -14,21 +14,33 @@ const searchApi = require(`${mRoot}/search-api`); |
|
|
|
|
|
// 店铺页
|
|
|
const shop = (shopId, req, res, next, brandInfo) => {
|
|
|
let domain = req.query.domain,
|
|
|
params = req.query;
|
|
|
|
|
|
_.unset(params, 'domain');
|
|
|
shopId = parseInt(shopId, 10);
|
|
|
Object.assign(params, {shopId: shopId});
|
|
|
|
|
|
list.getShopInfo(shopId, req.user.uid).then(shopInfo => {
|
|
|
if (+shopInfo.shopTemplateType === 2) { // 经典模板
|
|
|
let pjax = req.query._pjax;
|
|
|
let pjax = params._pjax;
|
|
|
|
|
|
// 比较品牌域名与店铺域名是否一致,不一致跳转至店铺域名
|
|
|
if (!pjax && shopInfo.domain && domain !== shopInfo.domain) {
|
|
|
res.redirect(helpers.urlFormat('', params, shopInfo.domain));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (+shopInfo.shopTemplateType === 2) { // 经典模板
|
|
|
|
|
|
if (pjax) {
|
|
|
list.getShopGoodsData(shopId, req.yoho.channel, req.query, shopInfo).then(result => {
|
|
|
list.getShopGoodsData(shopId, req.yoho.channel, params, shopInfo).then(result => {
|
|
|
Object.assign(result, {layout: false});
|
|
|
res.render('list/goods-list', result);
|
|
|
}).catch(next);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
list.getShopData(shopId, req.yoho.channel, req.query, shopInfo).then(result => {
|
|
|
list.getShopData(shopId, req.yoho.channel, params, shopInfo).then(result => {
|
|
|
Object.assign(result, {
|
|
|
page: 'shop',
|
|
|
shopId: shopId
|
...
|
...
|
@@ -41,7 +53,7 @@ const shop = (shopId, req, res, next, brandInfo) => { |
|
|
res.render('list/shop-index', result);
|
|
|
}).catch(next);
|
|
|
} else { // 基础模板
|
|
|
list.getBaseShopData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
|
|
|
list.getBaseShopData(params, Object.assign({uid: req.user.uid}, brandInfo),
|
|
|
req.yoho.channel, shopId).then(result => {
|
|
|
Object.assign(result, {page: 'list'});
|
|
|
|
...
|
...
|
|