|
@@ -23,7 +23,7 @@ class CartModel |
|
@@ -23,7 +23,7 @@ class CartModel |
23
|
* @param int $productSku 商品SKU
|
23
|
* @param int $productSku 商品SKU
|
24
|
* @param int $buyNumber 购买数量
|
24
|
* @param int $buyNumber 购买数量
|
25
|
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
|
25
|
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
|
26
|
- * @param int int $isEdit 是否是编辑商品SKU,0表示不是编辑
|
26
|
+ * @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
|
27
|
* @param null|int $promotionId 促销id,默认null(加价购有关)
|
27
|
* @param null|int $promotionId 促销id,默认null(加价购有关)
|
28
|
* @param null|int $uid 用户UID,可以不传
|
28
|
* @param null|int $uid 用户UID,可以不传
|
29
|
* @return array 加入购物车接口返回的数据
|
29
|
* @return array 加入购物车接口返回的数据
|
|
@@ -406,7 +406,7 @@ class CartModel |
|
@@ -406,7 +406,7 @@ class CartModel |
406
|
$oneGoods['name'] = $single['product_name'];
|
406
|
$oneGoods['name'] = $single['product_name'];
|
407
|
$oneGoods['color'] = $single['color_name'];
|
407
|
$oneGoods['color'] = $single['color_name'];
|
408
|
$oneGoods['size'] = $single['size_name'];
|
408
|
$oneGoods['size'] = $single['size_name'];
|
409
|
- $oneGoods['price'] = Helpers::transPrice($single['real_price']); // last_price有些带.00,有些不带,real_price都不带.00
|
409
|
+ $oneGoods['price'] = Helpers::transPrice($single['sales_price']);
|
410
|
$oneGoods['count'] = $single['buy_number'];
|
410
|
$oneGoods['count'] = $single['buy_number'];
|
411
|
|
411
|
|
412
|
$result['goods'][] = $oneGoods;
|
412
|
$result['goods'][] = $oneGoods;
|
|
@@ -428,18 +428,20 @@ class CartModel |
|
@@ -428,18 +428,20 @@ class CartModel |
428
|
}
|
428
|
}
|
429
|
|
429
|
|
430
|
// 有货币
|
430
|
// 有货币
|
431
|
- $result['yohoCoin'] = isset($orderCompute['use_yoho_coin']) ? isset($orderCompute['use_yoho_coin']) : $payReturn['yoho_coin'];
|
431
|
+ $result['yohoCoin'] = (isset($orderCompute['use_yoho_coin']) && !empty($orderCompute['use_yoho_coin'])) ? $orderCompute['use_yoho_coin'] : $payReturn['yoho_coin'];
|
432
|
|
432
|
|
433
|
// 订单数据
|
433
|
// 订单数据
|
434
|
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
|
434
|
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
|
435
|
$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
|
435
|
$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
|
436
|
- $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount'];
|
436
|
+ $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list'][1]['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
|
|
|
437
|
+ $couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false;
|
|
|
438
|
+ $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][3]['promotion_amount'];
|
437
|
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
|
439
|
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
|
438
|
- $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list']['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
|
|
|
439
|
$result['sumPrice'] = Helpers::transPrice($sumPrice);
|
440
|
$result['sumPrice'] = Helpers::transPrice($sumPrice);
|
440
|
$result['salePrice'] = Helpers::transPrice($salePrice);
|
441
|
$result['salePrice'] = Helpers::transPrice($salePrice);
|
441
|
$result['price'] = Helpers::transPrice($price);
|
442
|
$result['price'] = Helpers::transPrice($price);
|
442
|
- $result['freight'] = strtr($freight, array('¥'=>'','¥'=>'')) . '.00';
|
443
|
+ $result['freight'] = $freight;
|
|
|
444
|
+ $result['couponPrice'] = $couponPrice;
|
443
|
}
|
445
|
}
|
444
|
|
446
|
|
445
|
// 发票有关数据
|
447
|
// 发票有关数据
|
|
@@ -468,7 +470,7 @@ class CartModel |
|
@@ -468,7 +470,7 @@ class CartModel |
468
|
// 优惠券数据
|
470
|
// 优惠券数据
|
469
|
$coupons = array();
|
471
|
$coupons = array();
|
470
|
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
|
472
|
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
|
471
|
- $coupons += self::getCouponList($uid, 0, 1, true);
|
473
|
+ $coupons += self::getCouponList($uid, true);
|
472
|
$result['coupon'] = $coupons;
|
474
|
$result['coupon'] = $coupons;
|
473
|
}
|
475
|
}
|
474
|
|
476
|
|
|
@@ -535,7 +537,7 @@ class CartModel |
|
@@ -535,7 +537,7 @@ class CartModel |
535
|
if (isset($coupons['data'])) {
|
537
|
if (isset($coupons['data'])) {
|
536
|
|
538
|
|
537
|
if ($onlyTotal) {
|
539
|
if ($onlyTotal) {
|
538
|
- $result['count'] = $coupons['data']['total'];
|
540
|
+ $result['count'] = count($coupons['data']['couponList']);
|
539
|
} else {
|
541
|
} else {
|
540
|
$couponArr = array();
|
542
|
$couponArr = array();
|
541
|
isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList'];
|
543
|
isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList'];
|
|
@@ -605,7 +607,6 @@ class CartModel |
|
@@ -605,7 +607,6 @@ class CartModel |
605
|
{
|
607
|
{
|
606
|
$result = array();
|
608
|
$result = array();
|
607
|
|
609
|
|
608
|
- $oneGoods = array();
|
|
|
609
|
// 购买的可用商品列表
|
610
|
// 购买的可用商品列表
|
610
|
$validGoods = Helpers::formatCartGoods($data['goods_list']);
|
611
|
$validGoods = Helpers::formatCartGoods($data['goods_list']);
|
611
|
!empty($validGoods) && $result['goods'] = $validGoods;
|
612
|
!empty($validGoods) && $result['goods'] = $validGoods;
|