Authored by Rock Zhang

修复限购商品结算的连接跳转问题

Code Review By Rock Zhang
@@ -331,10 +331,9 @@ class CartModel @@ -331,10 +331,9 @@ class CartModel
331 $result = array(); 331 $result = array();
332 332
333 $skuList = ''; 333 $skuList = '';
334 - $hasSkuListCookie = isset($orderInfo['skuList']);  
335 - $isLimitGoods = $hasSkuListCookie || (!empty($sku) && !empty($skn) && !empty($buyNumber));  
336 - if ($isLimitGoods) { // 存在sku,skn和buyNumber或者cookie中有skuList时为限购商品  
337 - $skuList = $hasSkuListCookie ? $orderInfo['skuList'] : json_encode(array( 334 + $isLimitGoods = !empty($sku) && !empty($skn) && !empty($buyNumber);
  335 + if ($isLimitGoods) { // 存在sku,skn和buyNumber时为限购商品
  336 + $skuList = json_encode(array(
338 array( 337 array(
339 'type' => 'limitcode', 338 'type' => 'limitcode',
340 'limitproductcode' => $limitProductCode, 339 'limitproductcode' => $limitProductCode,
@@ -343,8 +342,6 @@ class CartModel @@ -343,8 +342,6 @@ class CartModel
343 'buy_number' => $buyNumber 342 'buy_number' => $buyNumber
344 ) 343 )
345 )); 344 ));
346 -  
347 - $result['skn'] = $skn;  
348 $result['isLimit'] = true; 345 $result['isLimit'] = true;
349 } 346 }
350 347
@@ -321,7 +321,7 @@ class IndexController extends AbstractAction @@ -321,7 +321,7 @@ class IndexController extends AbstractAction
321 321
322 // 限购商品时更换返回按钮地址 322 // 限购商品时更换返回按钮地址
323 if (isset($order['isLimit'])) { 323 if (isset($order['isLimit'])) {
324 - $returnUrl = Helpers::url('/product/show_' . $order['skn'] . '.html');; 324 + $returnUrl = Helpers::url('/product/show_' . $skn . '.html');
325 } 325 }
326 326
327 $data = array( 327 $data = array(
@@ -400,9 +400,20 @@ class IndexController extends AbstractAction @@ -400,9 +400,20 @@ class IndexController extends AbstractAction
400 // 审判跳转登录页 400 // 审判跳转登录页
401 $this->auditJumpLogin(); 401 $this->auditJumpLogin();
402 402
  403 + // 获取cookie中的信息
  404 + $cookieData = $this->getCookie('order-info', null);
  405 + $orderInfo = array();
  406 + if (!empty($cookieData)) {
  407 + $orderInfo = json_decode($cookieData, true);
  408 + }
  409 +
  410 + $returnUrl = Helpers::url('/cart/index/orderEnsure');
  411 + if (isset($orderInfo['limitUrlSufix'])) {
  412 + $returnUrl .= $orderInfo['limitUrlSufix'];
  413 + }
403 // 设置网站标题 414 // 设置网站标题
404 $this->setTitle('选择地址'); 415 $this->setTitle('选择地址');
405 - $this->setNavHeader('选择地址', Helpers::url('/cart/index/orderEnsure'), false); 416 + $this->setNavHeader('选择地址', $returnUrl, false);
406 417
407 $uid = $this->getUid(true); 418 $uid = $this->getUid(true);
408 $address = UserModel::getAddressData($uid); 419 $address = UserModel::getAddressData($uid);