...
|
...
|
@@ -546,7 +546,10 @@ class CartModel |
|
|
isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
|
|
|
|
|
|
// 优惠券数据
|
|
|
$coupons = array('couponName' => '');
|
|
|
$coupons = array(
|
|
|
'couponName' => '',
|
|
|
'count' => self::getValidCouponCount($uid)
|
|
|
);
|
|
|
if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) {
|
|
|
$coupons['couponName'] = $orderInfo['couponName'];
|
|
|
}
|
...
|
...
|
@@ -558,6 +561,24 @@ class CartModel |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--获取可用的优惠券数目
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @return int 可用优惠券的数目
|
|
|
*/
|
|
|
private static function getValidCouponCount($uid)
|
|
|
{
|
|
|
$count = 0;
|
|
|
|
|
|
$validCount = CartData::getValidCouponCount($uid);
|
|
|
if (isset($validCount['data']['count'])) {
|
|
|
$count = intval($validCount['data']['count']);
|
|
|
}
|
|
|
|
|
|
return $count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
...
|
...
|
@@ -630,15 +651,9 @@ class CartModel |
|
|
}
|
|
|
|
|
|
// 不可用的优惠券
|
|
|
$notValidCoupons = self::procCouponsData($coupons['data']['unusable_coupons']);
|
|
|
if (!empty($notValidCoupons)) {
|
|
|
$result['notAvailableCoupons'] = $notValidCoupons;
|
|
|
}
|
|
|
$result['notAvailableCoupons'] = self::procCouponsData($coupons['data']['unusable_coupons']);
|
|
|
// 可用优惠券
|
|
|
$validCoupons = self::procCouponsData($coupons['data']['usable_coupons']);
|
|
|
if (!empty($validCoupons)) {
|
|
|
$result['coupons'] = $validCoupons;
|
|
|
}
|
|
|
$result['coupons'] = self::procCouponsData($coupons['data']['usable_coupons']);
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
...
|
...
|
|