Browse Source

混合支付的下单

lizhen_gitee 4 days ago
parent
commit
b4f5a1afba
2 changed files with 9 additions and 8 deletions
  1. 4 4
      addons/shopro/listener/Order.php
  2. 5 4
      addons/shopro/service/order/OrderCreate.php

+ 4 - 4
addons/shopro/listener/Order.php

@@ -49,18 +49,18 @@ class Order
         // 如果需要支付积分
         if ($score_amount) {
             // 判断个人积分是否充足
-            if ($user->score < $score_amount) {
+            /*if ($user->score < $score_amount) {
                 // 积分不足
                 error_stop('积分不足');
-            }
+            }*/
         }
 
         if (floatval($money)) {
             // 判断个人余额是否充足
-            if ($user->money < $money) {
+            /*if ($user->money < $money) {
                 // 余额不足
                 error_stop('余额不足');
-            }
+            }*/
         }
 
         // 限购,库存锁定,活动处理

+ 5 - 4
addons/shopro/service/order/OrderCreate.php

@@ -1164,7 +1164,7 @@ class OrderCreate
             $orderData['pay_fee'] = $result['pay_fee'];
             $orderData['original_pay_fee'] = $result['pay_fee'];        // 记录支付总金额,后面可能会订单改价
 //            $orderData['remain_pay_fee'] = $result['pay_fee'];          // 这里还是显示应支付总金额,扣除动作放到实际支付时
-            $orderData['remain_pay_fee'] = $result['temp_remain_pay_fee'];          // 这里提现扣除善豆
+            $orderData['remain_pay_fee'] = $result['temp_remain_pay_fee'];          // 这里提前扣除善豆,取消订单再返回
             $orderData['total_discount_fee'] = $result['total_discount_fee'];
             $orderData['coupon_discount_fee'] = $result['coupon_discount_fee'];
             $orderData['promo_discount_fee'] = $result['promo_discount_fee'];
@@ -1244,10 +1244,11 @@ class OrderCreate
 
             // 将善豆扣掉
             $walletService = new Wallet();
-            if (!$walletService->change($this->user->id, -$result['goods_bean_amount'], 'bean', 131, '商城购物抵扣', 'shopro_order', $order->id)) {
-                error_stop($walletService->getMessage());
+            if($result['goods_bean_amount'] > 0){
+                if (!$walletService->change($this->user->id, -$result['goods_bean_amount'], 'bean', 131, '商城购物抵扣', 'shopro_order', $order->id)) {
+                    error_stop($walletService->getMessage());
+                }
             }
-
             //bill表args
             $bill_args = [];