...
|
...
|
@@ -60,8 +60,6 @@ const setShoppingCookie = (req, res) => { |
|
|
_r: 1
|
|
|
});
|
|
|
}
|
|
|
}).finally(() => {
|
|
|
return;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -151,12 +149,10 @@ const cartAdd = (req, res) => { |
|
|
}
|
|
|
|
|
|
if (result && result.code === 200) {
|
|
|
return setShoppingCookie(req, res).then(() => {
|
|
|
return res.send(result);
|
|
|
});
|
|
|
} else {
|
|
|
res.send(result);
|
|
|
yield setShoppingCookie(req, res);
|
|
|
}
|
|
|
|
|
|
res.send(result);
|
|
|
})();
|
|
|
};
|
|
|
|
...
|
...
|
@@ -179,7 +175,7 @@ const cartTotal = (req, res) => { |
|
|
/**
|
|
|
* 购物车商品选择与取消
|
|
|
*/
|
|
|
const selectProduct = (req, res) => {
|
|
|
const selectProduct = (req, res, next) => {
|
|
|
|
|
|
let uid = req.user.uid;
|
|
|
let productId = req.body.skuList;
|
...
|
...
|
@@ -190,11 +186,7 @@ const selectProduct = (req, res) => { |
|
|
service.selectGoods(uid, productId, shoppingKey, hasPromotion, cartDelList)
|
|
|
.then(ret => {
|
|
|
res.send(ret);
|
|
|
}).catch(() => {
|
|
|
res.send({
|
|
|
code: 400
|
|
|
});
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -241,11 +233,6 @@ const removeProduct = (req, res) => { |
|
|
|
|
|
if (ret && ret.code === 200) {
|
|
|
yield setShoppingCookie(req, res);
|
|
|
|
|
|
/* res.cookie('cart-del-list', cartDelList, {
|
|
|
domain: '.yohobuy.com',
|
|
|
path: '/'
|
|
|
});*/
|
|
|
}
|
|
|
|
|
|
return res.send(ret);
|
...
|
...
|
@@ -321,12 +308,6 @@ const getTogetherProduct = (req, res) => { |
|
|
co(function * () {
|
|
|
|
|
|
let page = req.query.page;
|
|
|
|
|
|
/* let ret = {
|
|
|
code: 200,
|
|
|
message: '凑单商品'
|
|
|
};*/
|
|
|
|
|
|
let ret = yield service.getTogetherProduct(page);
|
|
|
|
|
|
return res.send(ret);
|
...
|
...
|
@@ -363,12 +344,6 @@ const getIncreasePurchase = (req, res) => { |
|
|
co(function * () {
|
|
|
|
|
|
let page = req.query.page;
|
|
|
|
|
|
/* let ret = {
|
|
|
code: 200,
|
|
|
message: '凑单商品'
|
|
|
};*/
|
|
|
|
|
|
let ret = yield service.getTogetherProduct(page);
|
|
|
|
|
|
return res.send(ret);
|
...
|
...
|
|