Authored by zhangxiaoru

全部分类

... ... @@ -59,7 +59,7 @@ const brandList = (req, res, next) => {
res.render('brand/brand-list', {
layout: false,
brandList: result.brandList
})
});
}).catch(next);
};
... ... @@ -67,13 +67,13 @@ const categoryData = (req, res, next) => {
let code;
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1;
if (parseInt(gender) === 1) {
if (parseInt(gender, 10) === 1) {
code = '7f885e9cab53231cff34ea236f3f1120';
} else {
code = 'a6f9dc00219eb7d08520a18864929a30';
}
brandModel.categoryData(code, gender).then(result => {
brandModel.categoryData(code).then(result => {
res.render('brand/category', {
layout: false,
categoryData: result.categoryData
... ... @@ -97,7 +97,7 @@ const cateAll = (req, res, next) => {
// showFooterTab: footerModel.getUrlData('category')
});
}).catch(next);
}
};
module.exports = {
index,
... ...
... ... @@ -277,29 +277,29 @@ const brandListData = (code, gender) => {
list.brandList = brandList;
return list;
})
}
});
};
const categoryData = (code, gender) => {
const categoryData = (code) => {
return _getResourcesData(code).then(result => {
let categoryData = {};
let category = {};
let list = {};
if (result) {
_.forEach(result, function(data) {
if (data.template_name === 'recommend_content_five') {
categoryData.list = data.data.list;
category.list = data.data.list;
} else if (data.template_name === 'focus') {
categoryData.focusData = data;
category.focusData = data;
}
});
}
list.categoryData = categoryData;
list.categoryData = category;
return list;
});
}
};
const getCateData = (channel) => {
return api.get('', {
... ... @@ -322,7 +322,7 @@ const getCateData = (channel) => {
}).then((list) => {
return _processCateData(list, channel);
});
}
};
module.exports = {
indexData,
... ...