Authored by Rock Zhang

添加对修改购物车商品数据以及数目接口对传递商品sku以及sku的验证

Code Review By Rock Zhang
... ... @@ -311,11 +311,17 @@ class CartModel
{
$result = array('code' => 400, 'message' => '出错啦~');
$modify = CartData::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
do {
if (empty($sku)) {
braek;
}
$modify = CartData::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
return $result;
}
... ... @@ -332,14 +338,20 @@ class CartModel
{
$result = array('code' => 400, 'message' => '出错啦~');
// 处理要更改的数据
$swapData = json_encode(array($param));
do {
if (empty($param['old_product_sku']) || empty($param['new_product_sku'])) {
break;
}
$modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
// 处理要更改的数据
$swapData = json_encode(array($param));
$modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
return $result;
}
... ...