Explorar o código

用户订单退款处理

whitefang hai 1 ano
pai
achega
13b959fa57

+ 1 - 7
app/adminapi/logic/recharge/RechargeLogic.php

@@ -97,12 +97,6 @@ class RechargeLogic extends BaseLogic
                 'refund_status' => YesNoEnum::YES,
             ]);
 
-            // 更新用户余额及累计充值金额
-            User::where(['id' => $order['user_id']])
-                ->dec('total_recharge_amount', $order['order_amount'])
-                ->dec('user_money', $order['order_amount'])
-                ->update();
-
             // 记录日志
             AccountLogLogic::add(
                 $order['user_id'],
@@ -110,7 +104,7 @@ class RechargeLogic extends BaseLogic
                 AccountLogEnum::DEC,
                 $order['order_amount'],
                 $order['sn'],
-                '充值订单退款'
+                '订单退款'
             );
 
             // 生成退款记录

+ 1 - 14
app/adminapi/validate/recharge/RechargeRefundValidate.php

@@ -67,7 +67,7 @@ class RechargeRefundValidate extends BaseValidate
         $order = RechargeOrder::findOrEmpty($rechargeId);
 
         if ($order->isEmpty()) {
-            return '充值订单不存在';
+            return '订单不存在';
         }
 
         if ($order['pay_status'] != PayEnum::ISPAID) {
@@ -79,12 +79,6 @@ class RechargeRefundValidate extends BaseValidate
             return '订单已发起退款,退款失败请到退款记录重新退款';
         }
 
-        // 校验余额
-        $user = User::findOrEmpty($order['user_id']);
-        if ($user['user_money'] < $order['order_amount']) {
-            return '退款失败:用户余额已不足退款金额';
-        }
-
         return true;
     }
 
@@ -109,13 +103,6 @@ class RechargeRefundValidate extends BaseValidate
             return '该退款记录已退款成功';
         }
 
-        $order = RechargeOrder::findOrEmpty($record['order_id']);
-        $user = User::findOrEmpty($record['user_id']);
-
-        if ($user['user_money'] < $order['order_amount']) {
-            return '退款失败:用户余额已不足退款金额';
-        }
-
         return true;
     }
 

+ 0 - 1
app/common/logic/RefundLogic.php

@@ -69,7 +69,6 @@ class RefundLogic extends BaseLogic
                 default:
                     throw new \Exception('支付方式异常');
             }
-
             // 此处true并不表示退款成功,仅表示退款请求成功,具体成功与否由定时任务查询或通过退款回调得知
             return true;
         } catch (\Exception $e) {