From e3c5ce45dc9294420d5596eb84e95aba8bb69553 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 18 Feb 2022 16:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=9B=B6=E6=8F=90?= =?UTF-8?q?=E7=8E=B0=E5=88=B0=E9=93=B6=E8=A1=8C=E5=8D=A1=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/Dealer/WalletController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Endpoint/Api/Http/Controllers/Dealer/WalletController.php b/app/Endpoint/Api/Http/Controllers/Dealer/WalletController.php index 1c87dfcb..f3645260 100644 --- a/app/Endpoint/Api/Http/Controllers/Dealer/WalletController.php +++ b/app/Endpoint/Api/Http/Controllers/Dealer/WalletController.php @@ -8,6 +8,7 @@ use App\Endpoint\Api\Http\Resources\Dealer\WalletToBankLogResource; use App\Endpoint\Api\Http\Resources\Dealer\WalletToBankLogSimpleResource; use App\Enums\DealerWalletAction; use App\Exceptions\BizException; +use App\Exceptions\PayPasswordIncorrectException; use App\Helpers\Paginator as PaginatorHelper; use App\Models\DealerWalletToBankLog; use App\Services\Dealer\WalletService; @@ -41,10 +42,18 @@ class WalletController extends Controller { $input = $request->validate([ 'amount' => ['bail', 'required', 'int', 'min:1'], + 'pay_password' => ['bail', 'required', 'string'], + ], [], [ + 'amount' => '提现金额', + 'pay_password' => '支付密码', ]); $user = $request->user(); $amount = Arr::get($input, 'amount', 0); + //验证支付密码 + if (! $user->wallet?->verifyPassword($input['pay_password'] ?? '')) { + throw new PayPasswordIncorrectException(); + } if (empty($user->dealer->pay_info)) { throw new BizException('请先绑定设置收款信息'); @@ -69,7 +78,7 @@ class WalletController extends Controller $rate = app_settings('dealer.withdraw_fee_rate', '0.00');//手续费率 // $rate = 0; //计算手续费(四舍五入) - $serviceAmount = round(bcdiv($rate, 100, 4)*$amount); + $serviceAmount = round(bcdiv($rate, 100, 4) * $amount); //生成提现记录 $log = DealerWalletToBankLog::create([ @@ -77,7 +86,7 @@ class WalletController extends Controller 'amount'=> bcdiv($amount, 100, 2), 'rate' => $rate, 'service_amount' => bcdiv($serviceAmount, 100, 2), - 'account_amount' => bcdiv($amount-$serviceAmount, 100, 2), + 'account_amount' => bcdiv($amount - $serviceAmount, 100, 2), ]); //减去用户可提金额