...
|
...
|
@@ -7,6 +7,7 @@ |
|
|
const mRoot = '../models';
|
|
|
const list = require(`${mRoot}/list`);
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
// 搜索相关接口
|
|
|
const searchApi = require(`${mRoot}/search-api`);
|
...
|
...
|
@@ -32,12 +33,22 @@ const shop = (shopId, req, res, next, brandInfo) => { |
|
|
page: 'shop',
|
|
|
shopId: shopId
|
|
|
});
|
|
|
|
|
|
// 店铺装修为空则不cache
|
|
|
if (!result.shopTopBanner) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
|
|
}
|
|
|
res.render('list/shop-index', result);
|
|
|
}).catch(next);
|
|
|
} else { // 基础模板
|
|
|
list.getBaseShopData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
|
|
|
req.yoho.channel, shopId).then(result => {
|
|
|
Object.assign(result, {page: 'list'});
|
|
|
|
|
|
// 基础店铺装修为空则不cache
|
|
|
if (!result.shopTopBannerBase) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
|
|
}
|
|
|
res.render('list/brand', result);
|
|
|
}).catch(next);
|
|
|
}
|
...
|
...
|
@@ -55,6 +66,11 @@ exports.index = (req, res, next) => { |
|
|
|
|
|
list.getListData(req.query, req.yoho.channel).then(result => {
|
|
|
Object.assign(resData, result);
|
|
|
|
|
|
// 查询结果为空则不cache
|
|
|
if (_.isEmpty(_.get(resData, 'list.goods', []))) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
|
|
}
|
|
|
res.render('list/index', resData);
|
|
|
}).catch(next);
|
|
|
|
...
|
...
|
@@ -71,6 +87,11 @@ exports.new = (req, res, next) => { |
|
|
|
|
|
list.getListNewData(Object.assign({order: 's_t_desc'}, req.query), req.yoho.channel).then(result => {
|
|
|
Object.assign(resData, result);
|
|
|
|
|
|
// 查询结果为空则不cache
|
|
|
if (_.isEmpty(_.get(resData, 'list.goods', []))) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
|
|
}
|
|
|
res.render('list/index', resData);
|
|
|
}).catch(next);
|
|
|
|
...
|
...
|
@@ -166,6 +187,11 @@ exports.shopList = (req, res, next) => { |
|
|
if (req.query.query) {
|
|
|
result.shopKey = req.query.query;
|
|
|
}
|
|
|
|
|
|
// 店铺装修为空则不cache
|
|
|
if (!result.shopTopBanner) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
|
|
}
|
|
|
res.render('list/shop-list', result);
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
|