Authored by 郭成尧

old-code-del

... ... @@ -217,82 +217,6 @@ const shopFav = (req, res) => {
};
/**
* 旧版品类落地页
* TODO 已重构为 listNew 待删除
*/
const category = (req, res, next) => {
if (req.query) {
_.forEach(req.query, (perParam, index) => {
req.query[index] = stringProcess.paramsFilter(perParam);
});
}
let params = Object.assign({}, req.query);
let seoTitle;
if (req.query.title || req.query.sort_name) {
seoTitle = stringProcess.decodeURIComponent(req.query.title || req.query.sort_name);
}
/* 勿修改,唤起 APP 使用 */
let appParams = Object.assign({}, req.query, {
title: req.query.title || req.query.sort_name || '',
productPool: req.query.filter_poolId,
actiontype: req.query.actiontype || '1'
});
delete appParams.filter_poolId;
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' +
JSON.stringify(appParams) +
'}';
let uid = req.user.uid || 0;
// 获取第一页数据做服务端渲染
let initialData = _.assign({
gender: params.gender,
sort: parseInt(params.sort, 10) || '',
type: 'default',
order: '0',
page: 1,
limit: 24,
isApp: params.app_version
}, params);
if (uid) {
initialData.uid = uid;
}
req.ctx(searchModel).getSearchData(initialData).then((firstPageGoods) => {
res.render('search/goods-list', Object.assign({
_noLazy: true, // 首屏不使用lazyload
module: 'product',
page: 'search-list',
// canonical: {
// currentHref: 'https://www.yohobuy.com/list?' // TODO
// },
pageHeader: headerModel.setNav({
navTitle: seoTitle || '商品列表'
}),
goodList: params,
firstPageGoods: firstPageGoods || [],
suggestion: firstPageGoods.suggestion || [],
showDownloadApp: true,
pageFooter: true,
category: true,
localCss: true,
appPath: appPath,
introText: req.query.intro_text
}, searchProcess.getListSeoData({
gender: req.query.gender,
sort_name: seoTitle
})));
}).catch(next);
};
/**
* 品类落地页 SEO 友好的新路由
*/
const listNew = (req, res, next) => {
... ... @@ -670,7 +594,6 @@ const getBrandCouponsList = (req, res, next) => {
};
module.exports = {
category,
brand,
favoriteBrand,
shopIntro,
... ...