Authored by 郭成尧

read-property-of-undefined

... ... @@ -416,9 +416,10 @@ const getCategoryGoods = (req, res, next) => {
params.limit = 24;
req.ctx(searchModel).getCategoryGoods(params).then((result) => {
if (result.data.product_list && result.data.product_list.length > 0) {
let productList = _.get(result, 'data.product_list', []);
let product_list = productProcess.processProductList(result.data.product_list || [], {
if (productList.length > 0) {
let product_list = productProcess.processProductList(productList, {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
... ... @@ -427,7 +428,7 @@ const getCategoryGoods = (req, res, next) => {
res.render('search/page', {
layout: false,
new: product_list,
total: result.data.total,
total: _.get(result, 'data.total', 0)
});
} else {
res.json({});
... ...