|
@@ -7,6 +7,7 @@ |
|
@@ -7,6 +7,7 @@ |
7
|
const mRoot = '../models';
|
7
|
const mRoot = '../models';
|
8
|
const list = require(`${mRoot}/list`);
|
8
|
const list = require(`${mRoot}/list`);
|
9
|
const helpers = global.yoho.helpers;
|
9
|
const helpers = global.yoho.helpers;
|
|
|
10
|
+const _ = require('lodash');
|
10
|
|
11
|
|
11
|
// 搜索相关接口
|
12
|
// 搜索相关接口
|
12
|
const searchApi = require(`${mRoot}/search-api`);
|
13
|
const searchApi = require(`${mRoot}/search-api`);
|
|
@@ -32,12 +33,22 @@ const shop = (shopId, req, res, next, brandInfo) => { |
|
@@ -32,12 +33,22 @@ const shop = (shopId, req, res, next, brandInfo) => { |
32
|
page: 'shop',
|
33
|
page: 'shop',
|
33
|
shopId: shopId
|
34
|
shopId: shopId
|
34
|
});
|
35
|
});
|
|
|
36
|
+
|
|
|
37
|
+ // 店铺装修为空则不cache
|
|
|
38
|
+ if (!result.shopTopBanner) {
|
|
|
39
|
+ res.set('Cache-Control', 'no-cache');
|
|
|
40
|
+ }
|
35
|
res.render('list/shop-index', result);
|
41
|
res.render('list/shop-index', result);
|
36
|
}).catch(next);
|
42
|
}).catch(next);
|
37
|
} else { // 基础模板
|
43
|
} else { // 基础模板
|
38
|
list.getBaseShopData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
|
44
|
list.getBaseShopData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
|
39
|
req.yoho.channel, shopId).then(result => {
|
45
|
req.yoho.channel, shopId).then(result => {
|
40
|
Object.assign(result, {page: 'list'});
|
46
|
Object.assign(result, {page: 'list'});
|
|
|
47
|
+
|
|
|
48
|
+ // 基础店铺装修为空则不cache
|
|
|
49
|
+ if (!result.shopTopBannerBase) {
|
|
|
50
|
+ res.set('Cache-Control', 'no-cache');
|
|
|
51
|
+ }
|
41
|
res.render('list/brand', result);
|
52
|
res.render('list/brand', result);
|
42
|
}).catch(next);
|
53
|
}).catch(next);
|
43
|
}
|
54
|
}
|
|
@@ -55,6 +66,11 @@ exports.index = (req, res, next) => { |
|
@@ -55,6 +66,11 @@ exports.index = (req, res, next) => { |
55
|
|
66
|
|
56
|
list.getListData(req.query, req.yoho.channel).then(result => {
|
67
|
list.getListData(req.query, req.yoho.channel).then(result => {
|
57
|
Object.assign(resData, result);
|
68
|
Object.assign(resData, result);
|
|
|
69
|
+
|
|
|
70
|
+ // 查询结果为空则不cache
|
|
|
71
|
+ if (_.isEmpty(_.get(resData, 'list.goods', []))) {
|
|
|
72
|
+ res.set('Cache-Control', 'no-cache');
|
|
|
73
|
+ }
|
58
|
res.render('list/index', resData);
|
74
|
res.render('list/index', resData);
|
59
|
}).catch(next);
|
75
|
}).catch(next);
|
60
|
|
76
|
|
|
@@ -71,6 +87,11 @@ exports.new = (req, res, next) => { |
|
@@ -71,6 +87,11 @@ exports.new = (req, res, next) => { |
71
|
|
87
|
|
72
|
list.getListNewData(Object.assign({order: 's_t_desc'}, req.query), req.yoho.channel).then(result => {
|
88
|
list.getListNewData(Object.assign({order: 's_t_desc'}, req.query), req.yoho.channel).then(result => {
|
73
|
Object.assign(resData, result);
|
89
|
Object.assign(resData, result);
|
|
|
90
|
+
|
|
|
91
|
+ // 查询结果为空则不cache
|
|
|
92
|
+ if (_.isEmpty(_.get(resData, 'list.goods', []))) {
|
|
|
93
|
+ res.set('Cache-Control', 'no-cache');
|
|
|
94
|
+ }
|
74
|
res.render('list/index', resData);
|
95
|
res.render('list/index', resData);
|
75
|
}).catch(next);
|
96
|
}).catch(next);
|
76
|
|
97
|
|
|
@@ -166,6 +187,11 @@ exports.shopList = (req, res, next) => { |
|
@@ -166,6 +187,11 @@ exports.shopList = (req, res, next) => { |
166
|
if (req.query.query) {
|
187
|
if (req.query.query) {
|
167
|
result.shopKey = req.query.query;
|
188
|
result.shopKey = req.query.query;
|
168
|
}
|
189
|
}
|
|
|
190
|
+
|
|
|
191
|
+ // 店铺装修为空则不cache
|
|
|
192
|
+ if (!result.shopTopBanner) {
|
|
|
193
|
+ res.set('Cache-Control', 'no-cache');
|
|
|
194
|
+ }
|
169
|
res.render('list/shop-list', result);
|
195
|
res.render('list/shop-list', result);
|
170
|
}).catch(next);
|
196
|
}).catch(next);
|
171
|
};
|
197
|
};
|