...
|
...
|
@@ -8,38 +8,53 @@ const channels = { |
|
|
};
|
|
|
|
|
|
exports.productLst = function(req, res, next) {
|
|
|
let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
|
|
|
params = {
|
|
|
uid: req.user.uid || req.query.uid,
|
|
|
udid: req.query.udid,
|
|
|
promotion: req.query.pid,
|
|
|
let uid = req.user.uid || req.query.uid;
|
|
|
let udid = req.query.udid;
|
|
|
let getProductList;
|
|
|
|
|
|
if (req.query.maybeLike) {
|
|
|
getProductList = model.maybeLikeList(Object.assign({
|
|
|
uid: uid,
|
|
|
udid: udid,
|
|
|
yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1,
|
|
|
specified_sort: req.query.enum,
|
|
|
stocknumber: req.query.sn,
|
|
|
p_d: req.query.pd,
|
|
|
noDup: req.query.noDup,
|
|
|
limit: req.query.limit || 10
|
|
|
};
|
|
|
limit: req.query.limit || 12
|
|
|
}, req.query));
|
|
|
} else {
|
|
|
let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
|
|
|
params = {
|
|
|
uid: uid,
|
|
|
udid: udid,
|
|
|
promotion: req.query.pid,
|
|
|
yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1,
|
|
|
specified_sort: req.query.enum,
|
|
|
stocknumber: req.query.sn,
|
|
|
p_d: req.query.pd,
|
|
|
noDup: req.query.noDup,
|
|
|
limit: req.query.limit || 10
|
|
|
};
|
|
|
|
|
|
keys.forEach(function(k) {
|
|
|
if (req.query[k]) {
|
|
|
params[k] = req.query[k];
|
|
|
}
|
|
|
});
|
|
|
keys.forEach(function(k) {
|
|
|
if (req.query[k]) {
|
|
|
params[k] = req.query[k];
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (params.specified_sort) {
|
|
|
if (params.brand) {
|
|
|
params.limit = params.brand.split(',').length;
|
|
|
} else if (params.sort) {
|
|
|
params.limit = params.sort.split(',').length;
|
|
|
} else if (params.misort) {
|
|
|
params.limit = params.misort.split(',').length;
|
|
|
} else if (params.msort) {
|
|
|
params.limit = params.msort.split(',').length;
|
|
|
if (params.specified_sort) {
|
|
|
if (params.brand) {
|
|
|
params.limit = params.brand.split(',').length;
|
|
|
} else if (params.sort) {
|
|
|
params.limit = params.sort.split(',').length;
|
|
|
} else if (params.misort) {
|
|
|
params.limit = params.misort.split(',').length;
|
|
|
} else if (params.msort) {
|
|
|
params.limit = params.msort.split(',').length;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
getProductList = model.productLst(params);
|
|
|
}
|
|
|
|
|
|
model.productLst(params).then((result) => {
|
|
|
getProductList.then((result) => {
|
|
|
res.jsonp(result);
|
|
|
}).catch(next);
|
|
|
}; |
...
|
...
|
|