Authored by 毕凯

Merge branch 'hotfix/DelCartBug'

@@ -62,9 +62,8 @@ class CartData @@ -62,9 +62,8 @@ class CartData
62 public static function selectGoods($uid, $sku, $shoppingKey) 62 public static function selectGoods($uid, $sku, $shoppingKey)
63 { 63 {
64 $param = Yohobuy::param(); 64 $param = Yohobuy::param();
65 - $param['method'] = 'app.Shopping.selected'; 65 + $param['method'] = 'app.Shopping.selectedAndCart';
66 $param['product_sku_list'] = $sku; 66 $param['product_sku_list'] = $sku;
67 -  
68 if (!empty($uid)) { 67 if (!empty($uid)) {
69 $param['uid'] = $uid; 68 $param['uid'] = $uid;
70 } 69 }
@@ -112,7 +111,7 @@ class CartData @@ -112,7 +111,7 @@ class CartData
112 public static function removeFromCart($uid, $sku, $shoppingKey) 111 public static function removeFromCart($uid, $sku, $shoppingKey)
113 { 112 {
114 $param = Yohobuy::param(); 113 $param = Yohobuy::param();
115 - $param['method'] = 'app.Shopping.remove'; 114 + $param['method'] = 'app.Shopping.removeAndCart';
116 $param['product_sku_list'] = $sku; 115 $param['product_sku_list'] = $sku;
117 116
118 if (!empty($uid)) { 117 if (!empty($uid)) {
@@ -134,10 +133,10 @@ class CartData @@ -134,10 +133,10 @@ class CartData
134 * @param string $sku 商品sku列表 133 * @param string $sku 商品sku列表
135 * @return array 接口返回的数据 134 * @return array 接口返回的数据
136 */ 135 */
137 - public static function addToFav($uid, $sku) 136 + public static function addToFav($uid, $sku, $hasPromotion = false)
138 { 137 {
139 $param = Yohobuy::param(); 138 $param = Yohobuy::param();
140 - $param['method'] = 'app.Shopping.addfavorite'; 139 + $param['method'] = $hasPromotion ? 'app.Shopping.addfavoriteAndCart' : 'app.Shopping.addfavorite';
141 $param['product_sku_list'] = $sku; 140 $param['product_sku_list'] = $sku;
142 $param['uid'] = $uid; 141 $param['uid'] = $uid;
143 $param['client_secret'] = Sign::getSign($param); 142 $param['client_secret'] = Sign::getSign($param);
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -190,15 +190,16 @@ $('.icon-del').on('touchstart', function(e) { @@ -190,15 +190,16 @@ $('.icon-del').on('touchstart', function(e) {
190 rightBtnText: '确定' 190 rightBtnText: '确定'
191 } 191 }
192 }, function() { 192 }, function() {
193 - var id = $this.closest('.shopping-cart-good').data('id'), 193 + var $shoppingCartGood = $this.closest('.shopping-cart-good'),
194 count = $this.data('count'); 194 count = $this.data('count');
195 195
196 $.ajax({ 196 $.ajax({
197 method: 'post', 197 method: 'post',
198 url: '/cart/index/del', 198 url: '/cart/index/del',
199 data: { 199 data: {
200 - sku: id,  
201 - count: count 200 + sku: $shoppingCartGood.data('id'),
  201 + count: count,
  202 + promotionId: $shoppingCartGood.data('promotion')
202 } 203 }
203 }).then(function(data) { 204 }).then(function(data) {
204 if (data.code === 200) { 205 if (data.code === 200) {
@@ -168,13 +168,13 @@ class CartModel @@ -168,13 +168,13 @@ class CartModel
168 * @param string $shoppingKey 未登录用户唯一识别码 168 * @param string $shoppingKey 未登录用户唯一识别码
169 * @return array 接口返回的数据 169 * @return array 接口返回的数据
170 */ 170 */
171 - public static function removeFromCart($uid, $sku, $count, $shoppingKey, $hasPromotion = false) 171 + public static function removeFromCart($uid, $sku, $count, $shoppingKey, $promotionId = 0)
172 { 172 {
173 $result = array('code' => 400, 'message' => '出错啦~'); 173 $result = array('code' => 400, 'message' => '出错啦~');
174 174
175 // 处理sku 175 // 处理sku
176 - $sku_list = json_encode(array(array('product_sku'=>$sku,'buy_number'=>intval($count), 'promotion_id'=>$hasPromotion)));  
177 - $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey, $hasPromotion); 176 + $sku_list = json_encode(array(array('product_sku'=>$sku,'buy_number'=>intval($count), 'promotion_id'=>$promotionId)));
  177 + $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey);
178 if ($remove && isset($remove['code'])) { 178 if ($remove && isset($remove['code'])) {
179 $result['code'] = $remove['code']; 179 $result['code'] = $remove['code'];
180 $result['message'] = $remove['message']; 180 $result['message'] = $remove['message'];
@@ -122,7 +122,9 @@ class IndexController extends AbstractAction @@ -122,7 +122,9 @@ class IndexController extends AbstractAction
122 $count = $this->post('count', 0); 122 $count = $this->post('count', 0);
123 $uid = $this->getUid(true); 123 $uid = $this->getUid(true);
124 $shoppingKey = Helpers::getShoppingKeyByCookie(); 124 $shoppingKey = Helpers::getShoppingKeyByCookie();
125 - $result = CartModel::removeFromCart($uid, $sku, $count, $shoppingKey); 125 + $promotionId = $this->post('promotionId', 0);
  126 +
  127 + $result = CartModel::removeFromCart($uid, $sku, $count, $shoppingKey, $promotionId);
126 } 128 }
127 129
128 $this->echoJson($result); 130 $this->echoJson($result);