Authored by ccbikai(👎🏻🍜)

no-cache

... ... @@ -22,6 +22,10 @@ exports.index = (req, res, next) => {
}
model.floor(param, req.yoho.isApp, req.query.app_version).then(result => {
if (!result.length) {
res.set('Cache-Control', 'no-cache');
}
res.render('coupon-floor', {
module: 'activity',
page: 'coupon-floor',
... ... @@ -81,4 +85,4 @@ exports.receive = (req, res, next) => {
}, uid).then(result => {
res.json(result);
}).catch(next);
};
\ No newline at end of file
};
... ...
... ... @@ -38,6 +38,10 @@ let _channelPage = (req, res, data) => {
gender: data.gender,
uid: _.toString(req.user.uid)
}).then(result => {
if (!result.content.length || !result.sideNav.length) {
res.set('Cache-Control', 'no-cache');
}
res.render('channel', Object.assign({}, _renderData, data, result));
});
};
... ...
... ... @@ -242,8 +242,8 @@ let getChannelData = (params) => {
let navGender = _.cloneDeep(params.gender);
return Promise.all([_getChannelResource(params), _getLeftNav(navGender)]).then((data) => {
channelData.content = data[0]; // 资源位数据
channelData.sideNav = data[1]; // 侧边栏数据
channelData.content = data[0] || []; // 资源位数据
channelData.sideNav = data[1] || []; // 侧边栏数据
return channelData;
});
... ...
... ... @@ -47,6 +47,11 @@ const editor = (req, res, next) => {
articleListData.data.list.artList.forEach(articleData => {
build.push(guangProcess.formatArticle(articleData, true, isApp, false, uid));
});
if (!build.length) {
res.set('Cache-Control', 'no-cache');
}
res.render('index/list', Object.assign({
page: 'index-editor',
title: title,
... ... @@ -144,6 +149,11 @@ const index = (req, res, next) => {
};
indexModel.getArticle(param).then(result => {
if (result && result.guang && result.guang.infos) {
if (!result.guang.infos.length) {
res.set('Cache-Control', 'no-cache');
}
}
res.render('guang', Object.assign(responseData, result));
}).catch(next);
};
... ...
... ... @@ -131,6 +131,10 @@ const _shop = (req, res, shopId) => {
result.hotList[key].tags.isHot = true;
});
if (!result.storeName) {
res.set('Cache-Control', 'no-cache');
}
res.render('shop/index', {
module: 'product',
page: 'shop',
... ... @@ -284,6 +288,10 @@ const brand = (req, res, next) => {
}).then(brandHome => {
params.brandHome = brandHome;
if (!brandHome.id) {
res.set('Cache-Control', 'no-cache');
}
res.render('search/goods-list', {
module: 'product',
page: 'search-list',
... ...
... ... @@ -79,6 +79,10 @@ let index = (req, res, next) => {
res.locals.pageChannel = {};
res.locals.pageChannel[req.cookies._Channel] = true;
}
if (!result.length) {
res.set('Cache-Control', 'no-cache');
}
res.render('sale/index', Object.assign(params.renderData, {
content: result,
floorHeader: {
... ...