From e21ca4d47cbb11b196390c6dfe100300c7682456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=8B=BC?= <2468023037@qq.com> Date: Tue, 18 Feb 2025 17:50:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/API/PaymentNew.php | 4 +-- app/controller/api/WithdrawController.php | 43 +++++++++++++---------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/Utils/API/PaymentNew.php b/app/Utils/API/PaymentNew.php index 33e4db0..0d09b1c 100644 --- a/app/Utils/API/PaymentNew.php +++ b/app/Utils/API/PaymentNew.php @@ -54,7 +54,7 @@ class PaymentNew /** * 转账 */ - public static function pushMoney($money, $payeeAccountName, $payeeAccountNumber, $payeeBankName) + public static function pushMoney($money, $payeeAccountName, $payeeAccountNumber, $payeeBankName,$orderId) { $secret_key = "sZ2wAfh1lMkxBVrlY4uZY8Fj92E4scFf"; $url = "https://mdf.hr5688.com/api/createPaymentOrder"; @@ -79,7 +79,7 @@ class PaymentNew "PayeeIFSCCode" => "", "PaymentChannelId" => $PaymentChannelId, "ShopInformUrl" => "http://149.129.107.38/", - "ShopOrderId" => "11", + "ShopOrderId" => $orderId, "ShopUserLongId" => "776ae472-d4fc-435c-9639-be5763138d95" ]; diff --git a/app/controller/api/WithdrawController.php b/app/controller/api/WithdrawController.php index bac89da..295a2ea 100644 --- a/app/controller/api/WithdrawController.php +++ b/app/controller/api/WithdrawController.php @@ -117,13 +117,20 @@ class WithdrawController return ApiResponseApp::success(null, '等待管理员审核'); } //用户积分减少$money - // UserRewardDao::base($user_id, 1, - ($money_no + 300), '提现'); - $userbank = Userbank::where('id', $bank_id)->first(); - var_dump($money); - var_dump($userbank->bank_username); - var_dump($userbank->account); - var_dump($userbank->bank_name); - $res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name); + UserRewardDao::base($user_id, 1, - ($money_no + 300), '提现'); + $userbank = Userbank::where('id', $bank_id)->first();\ + //存入数据库 + Withdraw::create([ + 'user_id' => $user_id, + 'amount' => $money, + 'status' => 2, + 'createtime2' => date('Y-m-d H:i:s'), + 'username' => $user->username, + 'status_text' => '已到账', + ]); + //获取刚刚存入数据库的id(订单号) + $orderId = $withdraw->id; + PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name,$orderId); // var_dump($res); // //逻辑错误需要修改 // if ($res['Success'] == 200) { @@ -163,17 +170,17 @@ class WithdrawController $type = $request->post('type'); if ($type == 1) { - $res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name); - var_dump($res); - if ($res['Success'] == 200) { - $Withdraw = Withdraw::where('id', $id)->first(); - $Withdraw->status = 2; - $Withdraw->status_text = '已到账'; - $Withdraw->save(); - return ApiResponseApp::success(null, '转账成功'); - } else { - return ApiResponseApp::error(null, '转账失败'); - } + $res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name,$id); + // var_dump($res); + // if ($res['Success'] == 200) { + // $Withdraw = Withdraw::where('id', $id)->first(); + // $Withdraw->status = 2; + // $Withdraw->status_text = '已到账'; + // $Withdraw->save(); + // return ApiResponseApp::success(null, '转账成功'); + // } else { + // return ApiResponseApp::error(null, '转账失败'); + // } } else { $Withdraw = Withdraw::where('id', $id)->first(); $Withdraw->status = 3;