Authored by Rock Zhang

优化结算页面的性能

Code Review By Rock Zhang
... ... @@ -324,6 +324,12 @@ class CartModel
$pay = CartData::cartPay($uid, $cartType);
// 商品为空返回
if (!$pay || (isset($pay['data']['goods_list']) && empty($pay['data']['goods_list']))) {
$result['cartUrl'] = Helpers::url('/cart/index/index');
return $result;
}
if ($pay && isset($pay['code']) && $pay['code'] === 200) {
$payReturn = $pay['data'];
$address = array();
... ...
... ... @@ -283,22 +283,17 @@ class IndexController extends AbstractAction
$orderInfo = json_decode($cookieData, true);
$cartType = $orderInfo['cartType'];
}
$cartKey = 'commonCart';
if ($cartType === 'advance') {
$cartKey = 'preSellCart';
}
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartGoods = CartModel::getCartData($uid, $shoppingKey);
if (isset($cartGoods['isEmptyCart']) || empty($cartGoods[$cartKey])) {
$this->go(Helpers::url('/cart/index/index'));
$order = CartModel::cartPay($uid, $cartType, $orderInfo);
if (isset($order['cartUrl'])) {
$this->go($order['cartUrl']);
}
$data = array(
'orderEnsurePage' => true,
'isOrdinaryCart' => ($cartType !== 'advance'),
'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo)
'orderEnsure' => $order
);
$this->_view->display('order-ensure', $data);
... ...