From a3cf4283670dba681ae526a9aa0f5bcce08b31d0 Mon Sep 17 00:00:00 2001 From: ljl Date: Thu, 21 Sep 2023 15:13:05 +0800 Subject: [PATCH] yh --- app/Controller/Payment/PaymentController.php | 11 +++++++++++ config/routes.php | 1 + 2 files changed, 12 insertions(+) diff --git a/app/Controller/Payment/PaymentController.php b/app/Controller/Payment/PaymentController.php index 0cc1912..e0eadc4 100644 --- a/app/Controller/Payment/PaymentController.php +++ b/app/Controller/Payment/PaymentController.php @@ -75,6 +75,17 @@ class PaymentController extends AbstractController return $this->success(['url' => $url]); } + public function getBalance(RequestInterface $request) + { + [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); + $user = User::where('app_id', $app->app_id)->where('user_id', $data['userId'])->first(); + if (empty($user)) { + throw new BusinessException('用户不存在'); + } + $result = $this->userService->getBalance($user->member_id); + return $this->success(['result' => $result]); + } + public function payment(RequestInterface $request) { [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); $data = $this->paymentService->payment($data, $app, $token); diff --git a/config/routes.php b/config/routes.php index af963db..dc71d41 100644 --- a/config/routes.php +++ b/config/routes.php @@ -19,6 +19,7 @@ Router::addGroup('/payment',function () { Router::post('/pwd-forget', [PaymentController::class, 'pwdForget']); Router::post('/pwd-modify', [PaymentController::class, 'pwdModify']); Router::post('/payment', [PaymentController::class, 'payment']); + Router::post('/get-balance', [PaymentController::class, 'getBalance']); Router::post('/confirm-pay', [PaymentController::class, 'confirmPay']); Router::post('/query-order', [PaymentController::class, 'queryOrder']); Router::post('/transfer-pay', [PaymentController::class, 'transferPay']);