Showing
1 changed file
with
24 additions
and
9 deletions
@@ -546,7 +546,10 @@ class CartModel | @@ -546,7 +546,10 @@ class CartModel | ||
546 | isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg']; | 546 | isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg']; |
547 | 547 | ||
548 | // 优惠券数据 | 548 | // 优惠券数据 |
549 | - $coupons = array('couponName' => ''); | 549 | + $coupons = array( |
550 | + 'couponName' => '', | ||
551 | + 'count' => self::getValidCouponCount($uid) | ||
552 | + ); | ||
550 | if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) { | 553 | if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) { |
551 | $coupons['couponName'] = $orderInfo['couponName']; | 554 | $coupons['couponName'] = $orderInfo['couponName']; |
552 | } | 555 | } |
@@ -558,6 +561,24 @@ class CartModel | @@ -558,6 +561,24 @@ class CartModel | ||
558 | } | 561 | } |
559 | 562 | ||
560 | /** | 563 | /** |
564 | + * 购物车结算--获取可用的优惠券数目 | ||
565 | + * | ||
566 | + * @param int $uid 用户ID | ||
567 | + * @return int 可用优惠券的数目 | ||
568 | + */ | ||
569 | + private static function getValidCouponCount($uid) | ||
570 | + { | ||
571 | + $count = 0; | ||
572 | + | ||
573 | + $validCount = CartData::getValidCouponCount($uid); | ||
574 | + if (isset($validCount['data']['count'])) { | ||
575 | + $count = intval($validCount['data']['count']); | ||
576 | + } | ||
577 | + | ||
578 | + return $count; | ||
579 | + } | ||
580 | + | ||
581 | + /** | ||
561 | * 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理 | 582 | * 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理 |
562 | * | 583 | * |
563 | * @param int $uid 用户ID | 584 | * @param int $uid 用户ID |
@@ -630,15 +651,9 @@ class CartModel | @@ -630,15 +651,9 @@ class CartModel | ||
630 | } | 651 | } |
631 | 652 | ||
632 | // 不可用的优惠券 | 653 | // 不可用的优惠券 |
633 | - $notValidCoupons = self::procCouponsData($coupons['data']['unusable_coupons']); | ||
634 | - if (!empty($notValidCoupons)) { | ||
635 | - $result['notAvailableCoupons'] = $notValidCoupons; | ||
636 | - } | 654 | + $result['notAvailableCoupons'] = self::procCouponsData($coupons['data']['unusable_coupons']); |
637 | // 可用优惠券 | 655 | // 可用优惠券 |
638 | - $validCoupons = self::procCouponsData($coupons['data']['usable_coupons']); | ||
639 | - if (!empty($validCoupons)) { | ||
640 | - $result['coupons'] = $validCoupons; | ||
641 | - } | 656 | + $result['coupons'] = self::procCouponsData($coupons['data']['usable_coupons']); |
642 | } while (false); | 657 | } while (false); |
643 | 658 | ||
644 | return $result; | 659 | return $result; |
-
Please register or login to post a comment