فهرست منبع

加入购物车不找拆分的主订单

evoxwht 2 سال پیش
والد
کامیت
4349a46a6d
2فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 3 2
      crmeb/app/services/order/StoreCartServices.php
  2. 3 3
      crmeb/app/services/order/StoreOrderRefundServices.php

+ 3 - 2
crmeb/app/services/order/StoreCartServices.php

@@ -679,6 +679,7 @@ class StoreCartServices extends BaseServices
      * @param $num
      * @param $new
      * @return bool
+     * @throws \ReflectionException
      */
     public function checkLimit($uid, $product_id, $num, $new)
     {
@@ -701,8 +702,8 @@ class StoreCartServices extends BaseServices
             }
         } else if ($limitInfo['limit_type'] == 2) {
             $cartNum = $this->dao->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num');
-            $orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num');
-            $orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'refund_num');
+            $orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'pid' => 0], 'cart_num');
+            $orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'pid' => 0], 'refund_num');
             $orderNum = $orderPayNum - $orderRefundNum;
             if (($num + $orderNum + $cartNum) > $limitInfo['limit_num']) {
                 throw new ApiException(410240, ['limit' => $limitInfo['limit_num'], 'pay_num' => $orderNum]);

+ 3 - 3
crmeb/app/services/order/StoreOrderRefundServices.php

@@ -435,9 +435,9 @@ class StoreOrderRefundServices extends BaseServices
         $res = true;
         //回退优惠卷 拆分子订单不退优惠券
         if (!$order['pid'] && $order['coupon_id'] && $order['coupon_price']) {
-            /** @var StoreCouponUserServices $coumonUserServices */
-            $coumonUserServices = app()->make(StoreCouponUserServices::class);
-            $res = $res && $coumonUserServices->recoverCoupon((int)$order['coupon_id']);
+            /** @var StoreCouponUserServices $couponUserServices */
+            $couponUserServices = app()->make(StoreCouponUserServices::class);
+            $res = $couponUserServices->recoverCoupon((int)$order['coupon_id']);
             $statusService->save([
                 'oid' => $order['id'],
                 'change_type' => 'coupon_back',