From b2da675492a5ba954a4d0d8def7437d489afcfaf Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 15 Aug 2023 11:52:05 +0800 Subject: [PATCH] yh --- app/Controller/Payment/PaymentController.php | 8 +++++++ app/Service/UserService.php | 25 ++++++++++++++++++++ config/routes.php | 1 + 3 files changed, 34 insertions(+) diff --git a/app/Controller/Payment/PaymentController.php b/app/Controller/Payment/PaymentController.php index 5f163e4..ca12b41 100644 --- a/app/Controller/Payment/PaymentController.php +++ b/app/Controller/Payment/PaymentController.php @@ -99,4 +99,12 @@ class PaymentController extends AbstractController $data = $this->paymentService->refundApply($app, $data); return $this->success($data); } + + public function queryBindCards(RequestInterface $request) + { + [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); + $this->userService->rsyncBankCards($data['userId']); + $records = $this->userService->getUserBankCards($data['userId'], $app); + return $this->success(['result' => $records]); + } } diff --git a/app/Service/UserService.php b/app/Service/UserService.php index bcb0da3..c8c3851 100644 --- a/app/Service/UserService.php +++ b/app/Service/UserService.php @@ -105,6 +105,31 @@ class UserService extends AbstractService } } + public function getUserBankCards($userId, App $app) + { + $bankCards = BankCard::where('app_id', $app->app_id)->where('user_id', $userId)->get(); + $records = []; + foreach ($bankCards as $bankCard) { + $records[] = [ + 'agreementNo' => $bankCard->agreement_no, + 'cardUserName' => $bankCard->card_user_name, + 'lastCardNo' => $bankCard->last_card_no, + 'bankMobile' => $bankCard->bank_mobile, + 'bankCode' => $bankCard->bank_code, + 'bankName' => $bankCard->bank_name, + 'cardType' => $bankCard->card_type, + 'cnapsCode' => $bankCard->cnaps_code, + 'publicFlag' => $bankCard->public_flag, + 'repaymentDate' => $bankCard->repayment_date, + 'mainFlag' => $bankCard->main_flag, + 'status' => $bankCard->status, + 'avaFlag' => $bankCard->ava_flag, + 'remark' => $bankCard->remark, + ]; + } + return $records; + } + public function saveBankCard(array $data, User $user) { $appId = $user->app_id; diff --git a/config/routes.php b/config/routes.php index 09f27df..ba7896c 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('/query-bind-cards', [PaymentController::class, 'queryBindCards']); Router::post('/refund-apply', [PaymentController::class, 'refundApply']); Router::post('/refund-confirm', [PaymentController::class, 'refundConfirm']); Router::post('/refund-cancel', [PaymentController::class, 'refundCancel']);