From 2573c534468a1e189ba1c16006fa1f2415083830 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E7=8B=BC?= <2468023037@qq.com>
Date: Sun, 2 Mar 2025 12:24:14 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/controller/admin/api/v1/WithdrawController.php | 12 ++++++++----
 app/controller/api/WithdrawController.php          |  5 ++++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/app/controller/admin/api/v1/WithdrawController.php b/app/controller/admin/api/v1/WithdrawController.php
index cf3462d..219bec1 100644
--- a/app/controller/admin/api/v1/WithdrawController.php
+++ b/app/controller/admin/api/v1/WithdrawController.php
@@ -84,9 +84,13 @@ class WithdrawController
         $rate = ExchangeRate::where('type', 'BDT')->get();
         //计算积分
         $money = $amount * 100 / $rate[0]['points'] + 300;
+        $Withdraw = Withdraw::where('id', $id)->first();
+        if($Withdraw->status != 1){
+            return ApiResponse::error(400,[],'请勿重复点击');
+        }
         //不同意
         if ($type == 1) {
-            $Withdraw = Withdraw::where('id', $id)->first();
+            // $Withdraw = Withdraw::where('id', $id)->first();
             $Withdraw->status = 3;
             $Withdraw->status_text = '已驳回';
             $Withdraw->save();
@@ -99,21 +103,21 @@ class WithdrawController
         if ($userbank) {
             $res = PaymentNew::pushMoney($amount, $userbank->bank_username, $userbank->account, $userbank->bank_name, $id);
             if(!$res->Success){
-                $Withdraw = Withdraw::where('id', $id)->first();
+                // $Withdraw = Withdraw::where('id', $id)->first();
                 $Withdraw->status = 5;
                 $Withdraw->status_text = '支付失败:用户银行信息存在问题';
                 $Withdraw->save();
                 UserRewardDao::base($user_id, 1, $money, '提现失败返还');
                 return ApiResponse::error(400,[],'用户银行信息存在问题');
             }
-            $Withdraw = Withdraw::where('id', $id)->first();
+            // $Withdraw = Withdraw::where('id', $id)->first();
             $Withdraw->status = 2;
             $Withdraw->status_text = '已到账';
             $Withdraw->order_number = $res->TrackingNumber ?? null;
             $Withdraw->save();
             return ApiResponse::success(200, null, '操作成功');
         } else {
-            $Withdraw = Withdraw::where('id', $id)->first();
+            // $Withdraw = Withdraw::where('id', $id)->first();
             $Withdraw->status = 5;
             $Withdraw->status_text = '支付失败:用户银行信息存在问题';
             $Withdraw->save();
diff --git a/app/controller/api/WithdrawController.php b/app/controller/api/WithdrawController.php
index e11bc52..4d393eb 100644
--- a/app/controller/api/WithdrawController.php
+++ b/app/controller/api/WithdrawController.php
@@ -170,9 +170,12 @@ class WithdrawController
             if($res->ErrorMessage == "PayeeAccountNumberFormatError"){
                 $errorMsg = '收款人卡号格式错误';
             }
+            if($errorMsg == ''){
+                $errorMsg = '未知错误';
+            }
             $withdraw->update([
                 'status' => 5, //
-                'status_text' => '支付错误:'.$errorMsg
+                'status_text' => '支付错误:'.$res->ErrorMessage
             ]);
             UserRewardDao::base($user_id, 1, $money_no + 300, '提现失败返还');
             // if ($res->ErrorMessage == "PayeeAccountNameFormatError") {