...
|
...
|
@@ -98,6 +98,35 @@ const miniCart = (req, res, next) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 首页迷你购物车删除数据信息
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @param next
|
|
|
*/
|
|
|
const delCartGoods = (req, res, next) => {
|
|
|
|
|
|
let uid = req.user.uid;
|
|
|
let shoppingKey = helper.getShoppingKeyByCookie(req);
|
|
|
let productSku = req.query.product_sku;
|
|
|
let buyNumber = req.query.product_num || 1;
|
|
|
let callback = req.query.callback;
|
|
|
let skuList = {};
|
|
|
|
|
|
skuList[productSku] = parseInt(buyNumber);
|
|
|
|
|
|
service.removeFromCart(uid, shoppingKey, JSON.stringify(skuList))
|
|
|
.then(ret => {
|
|
|
if (ret && ret.code === 200 && _.has(ret, 'data.goods_count')) {
|
|
|
ret.data.total_goods_num = ret.data.goods_count;
|
|
|
return res.send(callback + '(' + JSON.stringify(ret) + ')');
|
|
|
} else {
|
|
|
return res.send(callback + '(' + JSON.stringify(ret) + ')');
|
|
|
}
|
|
|
})
|
|
|
.catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 我的购物车
|
|
|
*/
|
|
|
const cart = (req, res, next) => {
|
...
|
...
|
@@ -441,5 +470,6 @@ module.exports = { |
|
|
swapGift,
|
|
|
queryUserPromotionGift,
|
|
|
getCoupons,
|
|
|
miniCart
|
|
|
miniCart,
|
|
|
delCartGoods
|
|
|
}; |
...
|
...
|
|