From 3ee760e3a7408b731db98df1fefef80d5f121f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=8B=BC?= <2468023037@qq.com> Date: Sat, 22 Feb 2025 15:26:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/api/v1/WithdrawController.php | 14 +++++++++----- app/controller/api/WithdrawController.php | 6 ++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/controller/admin/api/v1/WithdrawController.php b/app/controller/admin/api/v1/WithdrawController.php index 0957d18..073c613 100644 --- a/app/controller/admin/api/v1/WithdrawController.php +++ b/app/controller/admin/api/v1/WithdrawController.php @@ -80,17 +80,16 @@ class WithdrawController $user_id = $request->post('user_id'); //是否同意转账 $type = $request->post('type'); + + $rate = ExchangeRate::where('type', 'BDT')->get(); + //计算积分 + $money = $amount * 100 / $rate[0]['points'] + 300; //不同意 if ($type == 1) { $Withdraw = Withdraw::where('id', $id)->first(); $Withdraw->status = 3; $Withdraw->status_text = '已驳回'; $Withdraw->save(); - $rate = ExchangeRate::where('type', 'BDT')->get(); - //计算积分 - $money = $amount * 100 / $rate[0]['points'] + 300; - //用户id - $user_id = $request->data['id']; //用户积分增加$money UserRewardDao::base($user_id, 1, $money, '提现失败返还'); return ApiResponse::success(200, null, '操作成功'); @@ -105,6 +104,11 @@ class WithdrawController $Withdraw->save(); return ApiResponse::success(200, null, '操作成功'); } else { + $Withdraw = Withdraw::where('id', $id)->first(); + $Withdraw->status = 5; + $Withdraw->status_text = '支付失败:用户银行信息存在问题'; + $Withdraw->save(); + UserRewardDao::base($user_id, 1, $money, '提现失败返还'); return ApiResponse::error(200, null, '用户银行信息存在问题'); } } diff --git a/app/controller/api/WithdrawController.php b/app/controller/api/WithdrawController.php index 3946401..1de19f4 100644 --- a/app/controller/api/WithdrawController.php +++ b/app/controller/api/WithdrawController.php @@ -143,6 +143,7 @@ class WithdrawController ]); return ApiResponseApp::success(null, '转账成功'); } else { + UserRewardDao::base($user_id, 1, $money_no + 300, '提现失败返还'); if ($res->ErrorMessage == "PayeeAccountNumberFormatError") { return ApiResponseApp::error(null, '收款人帐号格式错误'); } @@ -170,6 +171,11 @@ class WithdrawController 'status' => 5, 'status_text' => '支付失败: ' . $failedMessage, ]); + }else{ + $withdraw->update([ + 'status' => 2, + 'status_text' => '已到账', + ]); } } }