...
|
...
|
@@ -439,7 +439,7 @@ const getCartCount = (uid, shoppingKey) => { |
|
|
* @param string $shoppingKey 购物车在浏览器的唯一识别码,可以不传
|
|
|
* @return array 加入购物车接口返回的数据
|
|
|
*/
|
|
|
const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey) => {
|
|
|
const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey, cartDelList) => {
|
|
|
|
|
|
return co(function * () {
|
|
|
let result = {
|
...
|
...
|
@@ -454,9 +454,13 @@ const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, s |
|
|
let ret = yield cartApi.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey);
|
|
|
|
|
|
if (ret && ret.code) {
|
|
|
result = ret;
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: yield getCartData(uid, shoppingKey, cartDelList)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
|
|
|
/* if (empty($addCart) || (isset($addCart['code']) && $addCart['code'] !== 200) ) {
|
|
|
UdpLog::info('【购物车】校验参数传递auth','productSku:'.$productSku.'buyNumber:'.$buyNumber.
|
|
|
'goodsType:'.$goodsType,'isEdit:'.$isEdit.'promotionId:'.$promotionId.'uid:'.$uid.'shoppingKey:'.$shoppingKey);
|
...
|
...
|
@@ -517,7 +521,7 @@ const selectGoods = (uid, skuList, shoppingKey, hasPromotion, cartDelList) => { |
|
|
* @param string $shoppingKey 未登录用户唯一识别码
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => {
|
|
|
const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey, cartDelList) => {
|
|
|
|
|
|
return co(function * () {
|
|
|
let result = {
|
...
|
...
|
@@ -530,10 +534,13 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
let modify = yield cartApi.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey);
|
|
|
let ret = yield cartApi.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey);
|
|
|
|
|
|
if (modify && modify.code) {
|
|
|
result = modify;
|
|
|
if (ret && ret.code) {
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: yield getCartData(uid, shoppingKey, cartDelList)
|
|
|
};
|
|
|
}/* else {
|
|
|
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'sku:' . $sku, 'increaseNum:'
|
|
|
. $increaseNum . 'decreaseNum:' . $decreaseNum . 'shoppingKey:' . $shoppingKey);
|
...
|
...
|
@@ -554,7 +561,7 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => { |
|
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => {
|
|
|
const removeFromCart = (uid, shoppingKey, skuList, hasPromotion, cartDelList) => {
|
|
|
|
|
|
return co(function * () {
|
|
|
let result = {
|
...
|
...
|
@@ -567,14 +574,13 @@ const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
let remove = yield cartApi.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
|
|
|
let ret = yield cartApi.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
|
|
|
|
|
|
if (remove && remove.code) {
|
|
|
result.code = remove.code;
|
|
|
result.message = remove.message;
|
|
|
if (remove.data && remove.data.goods_count) {
|
|
|
result.totalGoodsNum = remove.data.goods_count;
|
|
|
}
|
|
|
if (ret && ret.code) {
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: chelper.formatCart(ret, uid, shoppingKey, cartDelList)
|
|
|
};
|
|
|
}/* else {
|
|
|
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' .
|
|
|
$skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
|
...
|
...
|
@@ -592,7 +598,7 @@ const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => { |
|
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
const addToFav = (uid, skuList, hasPromotion) => {
|
|
|
const addToFav = (uid, skuList, hasPromotion, cartDelList) => {
|
|
|
|
|
|
return co(function * () {
|
|
|
let result = {
|
...
|
...
|
@@ -617,10 +623,13 @@ const addToFav = (uid, skuList, hasPromotion) => { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
let add = yield cartApi.addToFav(uid, skuList, hasPromotion);
|
|
|
let ret = yield cartApi.addToFav(uid, skuList, hasPromotion);
|
|
|
|
|
|
if (add && add.code) {
|
|
|
result = add;
|
|
|
if (ret && ret.code) {
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: chelper.formatCart(ret, uid, null, cartDelList)
|
|
|
};
|
|
|
}/* else {
|
|
|
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'hasPromotion:' . $hasPromotion);
|
|
|
}*/
|
...
|
...
|
@@ -831,13 +840,47 @@ const getTogetherProduct = (page) => { |
|
|
})();
|
|
|
};
|
|
|
|
|
|
const modifyProduct = (param) => {
|
|
|
const modifyProduct = (param, uid, shoppingKey, cartDelList) => {
|
|
|
|
|
|
return cartApi.modifyProduct(param);
|
|
|
return co(function * () {
|
|
|
let result = {
|
|
|
code: 400,
|
|
|
message: ERROR_400_MESSAGE
|
|
|
};
|
|
|
|
|
|
let ret = yield cartApi.modifyProduct(param);
|
|
|
|
|
|
if (ret && ret.code) {
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: yield getCartData(uid, shoppingKey, cartDelList)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku) => {
|
|
|
return cartApi.swapGift(uid, shoppingKey, promotionId, newSkn, newSku);
|
|
|
const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => {
|
|
|
return co(function * () {
|
|
|
|
|
|
let result = {
|
|
|
code: 400,
|
|
|
message: ERROR_400_MESSAGE
|
|
|
};
|
|
|
|
|
|
let ret = yield cartApi.swapGift(uid, shoppingKey, promotionId, newSkn, newSku);
|
|
|
|
|
|
if (ret && ret.code) {
|
|
|
result = {
|
|
|
code: ret.code,
|
|
|
data: yield getCartData(uid, shoppingKey, cartDelList)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
})();
|
|
|
|
|
|
};
|
|
|
|
|
|
const queryUserPromotionGift = (promotionId, uid, shoppingKey) => {
|
...
|
...
|
|