...
|
...
|
@@ -103,7 +103,7 @@ class CartModel |
|
|
|
|
|
/* 普通购物车 */
|
|
|
$result['commonGoodsCount'] = $ordinaryCount;
|
|
|
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
|
|
|
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy, false);
|
|
|
/* 预售购物车 */
|
|
|
$result['presellGoodsCount'] = $advanceCount;
|
|
|
$result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
|
...
|
...
|
@@ -722,15 +722,16 @@ class CartModel |
|
|
* @param array $data 不同类型购物车数据
|
|
|
* @param bool $onlyGift 只获取赠品的商品数据
|
|
|
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
|
|
|
* @param bool $isAdvanceCart 是否是预售购物车,默认是,(和上市期有关)
|
|
|
* @return array $result 处理之后的不同类型购物车数据
|
|
|
*/
|
|
|
private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false)
|
|
|
private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false, $isAdvanceCart = true)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
do {
|
|
|
// 数据为空时返回空的标志
|
|
|
if (empty($data)) {
|
|
|
if (empty($data['goods_list'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -746,13 +747,13 @@ class CartModel |
|
|
}
|
|
|
|
|
|
// 购买的可用商品列表
|
|
|
$validGoods = Helpers::formatCartGoods($data['goods_list']);
|
|
|
$validGoods = Helpers::formatCartGoods($data['goods_list'], $isAdvanceCart);
|
|
|
if (!empty($validGoods)) {
|
|
|
$result['goods'] = $validGoods;
|
|
|
}
|
|
|
|
|
|
// 失效商品列表
|
|
|
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list'], false);
|
|
|
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list'], $isAdvanceCart, false);
|
|
|
if (!empty($notValidGoods)) {
|
|
|
$result['notValidGoods'] = $notValidGoods;
|
|
|
}
|
...
|
...
|
|