Authored by 郭成尧

add-params

... ... @@ -15,6 +15,24 @@ const redirect = (req, res) => {
return res.redirect(301, pathParamsUrl);
};
const _formatParams = (query) => {
let finalParams = {};
if (query.price) {
finalParams.price = query.price;
}
if (query.color) {
finalParams.color = query.color;
}
if (query.gender) {
finalParams.gender = query.gender;
}
return finalParams;
};
const list = (req, res, next) => {
let brand = req.query.brand;
let sort = req.query.sort;
... ... @@ -37,7 +55,7 @@ const list = (req, res, next) => {
param.sort = sort;
}
let arrs = [model.list(param)];
let arrs = [model.list(_.assign(param, _formatParams(req.query)))];
if (brand) {
arrs.push(model.getBrand({
... ...