Authored by Rock Zhang

移动购物车的目录结构

Code Review By Rock Zhang
framework @ e9d066dd
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
@@ -482,9 +482,16 @@ class CartModel @@ -482,9 +482,16 @@ class CartModel
482 // 订单数据 482 // 订单数据
483 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 483 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
484 $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; 484 $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
485 - $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list'][1]['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount']; 485 +
  486 + $freight = '¥0';
  487 + if (isset($orderCompute['promotion_formula_list'][1]['promotion_amount'])) {
  488 + $freight = $orderCompute['promotion_formula_list'][1]['promotion_amount'];
  489 + } elseif(isset($payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'])) {
  490 + $freight = $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
  491 + }
  492 +
486 $couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false; 493 $couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false;
487 - $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][3]['promotion_amount']; 494 + $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount'];
488 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; 495 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
489 $result['sumPrice'] = Helpers::transPrice($sumPrice); 496 $result['sumPrice'] = Helpers::transPrice($sumPrice);
490 $result['salePrice'] = Helpers::transPrice($salePrice); 497 $result['salePrice'] = Helpers::transPrice($salePrice);
@@ -211,6 +211,30 @@ class IndexController extends AbstractAction @@ -211,6 +211,30 @@ class IndexController extends AbstractAction
211 } 211 }
212 212
213 /** 213 /**
  214 + * 修改购物车商品数量
  215 + */
  216 + public function modifyNumAction()
  217 + {
  218 + $result = array();
  219 +
  220 + if ($this->isAjax()) {
  221 + $shoppingKey = $this->getSession('shoppingKey');
  222 + $uid = $this->getUid(true);
  223 +
  224 + $sku= $this->post('sku', 0);
  225 + $increaseNum = $this->post('increaseNum', null);
  226 + $decreaseNum = $this->post('decreaseNum', null);
  227 + $result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
  228 + }
  229 +
  230 + if (empty($result)) {
  231 + echo ' ';
  232 + } else {
  233 + $this->echoJson($result);
  234 + }
  235 + }
  236 +
  237 + /**
214 * 修改购物车商品数据 238 * 修改购物车商品数据
215 */ 239 */
216 public function modifyAction() 240 public function modifyAction()