...
|
...
|
@@ -63,13 +63,13 @@ class CartModel |
|
|
|
|
|
/* 普通购物车 */
|
|
|
if(isset($cart['ordinary_cart_data'])) {
|
|
|
$result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']);
|
|
|
$result['commonGoodsCount'] = $cart['ordinary_cart_data']['shopping_cart_data']['goods_count'];
|
|
|
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data']);
|
|
|
}
|
|
|
|
|
|
/* 预售购物车 */
|
|
|
if(isset($cart['advance_cart_data'])) {
|
|
|
$result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']);
|
|
|
$result['presellGoodsCount'] = $cart['advance_cart_data']['shopping_cart_data']['goods_count'];
|
|
|
$result['preSellCart'] = self::procCartData($cart['advance_cart_data']);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -79,6 +79,30 @@ class CartModel |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车商品选择与取消接口返回的数据处理
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $sku 商品sku列表
|
|
|
* @param string $shoppingKey 未登录用户唯一识别码
|
|
|
* @return array 处理之后的数据的数据
|
|
|
*/
|
|
|
public static function selectGoods($uid, $sku, $shoppingKey)
|
|
|
{
|
|
|
$result = array('code' => 400, 'message' => '出错啦~');
|
|
|
|
|
|
// 处理sku
|
|
|
$sku_list = json_encode(array($sku => 1));
|
|
|
|
|
|
$select = CartData::selectGoods($uid, $sku_list, $shoppingKey);
|
|
|
if ($select && isset($select['code'])) {
|
|
|
$result['code'] = $select['code'];
|
|
|
$result['message'] = $select['message'];
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 移出购物车
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
...
|
...
|
@@ -567,31 +591,25 @@ class CartModel |
|
|
$result = array();
|
|
|
|
|
|
$oneGoods = array();
|
|
|
// 购买的商品列表
|
|
|
foreach ($data['goods_list'] as $value) {
|
|
|
$oneGoods['id'] = $value['product_sku'];
|
|
|
$oneGoods['skn'] = $value['product_skn'];
|
|
|
$oneGoods['name'] = $value['product_name'];
|
|
|
$oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
|
|
|
$oneGoods['color'] = $value['color_name'];
|
|
|
$oneGoods['size'] = $value['size_name'];
|
|
|
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
|
|
|
$oneGoods['price'] = $value['real_price'];
|
|
|
$oneGoods['count'] = $value['buy_number'];
|
|
|
$oneGoods['lowStocks'] = true;
|
|
|
|
|
|
$result['goods'][] = $oneGoods;
|
|
|
}
|
|
|
// 购买的可用商品列表
|
|
|
$validGoods = Helpers::formatCartGoods($data['goods_list']);
|
|
|
!empty($validGoods) && $result['goods'] = $validGoods;
|
|
|
|
|
|
// 失效商品列表
|
|
|
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
|
|
|
!empty($notValidGoods) && $result['$notValidGoods'] = $notValidGoods;
|
|
|
|
|
|
// 赠品
|
|
|
count($data['gift_list']) && $result['freebieOrAdvanceBuy'] = true;
|
|
|
(count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true;
|
|
|
$result['freebie'] = $data['gift_list'];
|
|
|
// 加价购
|
|
|
$result['advanceBuy'] = $data['price_gift'];
|
|
|
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
|
|
|
// 结算数据
|
|
|
$result['price'] = $data['shopping_cart_data']['order_amount'];
|
|
|
$result['activityPrice'] = $data['shopping_cart_data']['discount_amount'];
|
|
|
$result['count'] = $data['shopping_cart_data']['goods_count'];
|
|
|
$result['sumPrice'] = $data['shopping_cart_data']['order_amount'];
|
|
|
print_r($result);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
|