Authored by Rock Zhang

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

Code Review By Rock Zhang
@@ -311,11 +311,17 @@ class CartModel @@ -311,11 +311,17 @@ class CartModel
311 { 311 {
312 $result = array('code' => 400, 'message' => '出错啦~'); 312 $result = array('code' => 400, 'message' => '出错啦~');
313 313
  314 + do {
  315 + if (empty($sku)) {
  316 + braek;
  317 + }
  318 +
314 $modify = CartData::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey); 319 $modify = CartData::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
315 if ($modify && isset($modify['code'])) { 320 if ($modify && isset($modify['code'])) {
316 $result['code'] = $modify['code']; 321 $result['code'] = $modify['code'];
317 $result['message'] = $modify['message']; 322 $result['message'] = $modify['message'];
318 } 323 }
  324 + }while(0);
319 325
320 return $result; 326 return $result;
321 } 327 }
@@ -332,6 +338,11 @@ class CartModel @@ -332,6 +338,11 @@ class CartModel
332 { 338 {
333 $result = array('code' => 400, 'message' => '出错啦~'); 339 $result = array('code' => 400, 'message' => '出错啦~');
334 340
  341 + do {
  342 + if (empty($param['old_product_sku']) || empty($param['new_product_sku'])) {
  343 + break;
  344 + }
  345 +
335 // 处理要更改的数据 346 // 处理要更改的数据
336 $swapData = json_encode(array($param)); 347 $swapData = json_encode(array($param));
337 348
@@ -340,6 +351,7 @@ class CartModel @@ -340,6 +351,7 @@ class CartModel
340 $result['code'] = $modify['code']; 351 $result['code'] = $modify['code'];
341 $result['message'] = $modify['message']; 352 $result['message'] = $modify['message'];
342 } 353 }
  354 + }while(0);
343 355
344 return $result; 356 return $result;
345 } 357 }