From 2033a091dfc728498d632209eb914b6bf36edaea Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Thu, 21 Dec 2023 22:20:33 +0800 Subject: [PATCH] yh --- app/Controller/Payment/AccountController.php | 8 ++++++-- public/account.html | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php index c77d51a..4a2772a 100644 --- a/app/Controller/Payment/AccountController.php +++ b/app/Controller/Payment/AccountController.php @@ -115,7 +115,11 @@ class AccountController extends AbstractController { $userInfo = $this->checkUser($request); $userId = $this->resetUserId($userInfo['userId']); - $requestLog = $this->createRequestLog(['userId' => $userId]); + $bankCard = BankCard::where('id', $request->input('id', 0))->first(); + if (!$bankCard || $bankCard->user_id != $userId) { + throw new BusinessException('银行卡不存在'); + } + $requestLog = $this->createRequestLog(['userId' => $userId, 'agreementNo' => $bankCard->agreement_no]); $result = $this->userService->unbindCard($requestLog->getData(), $requestLog->app); return $this->success(['result' => $result]); } @@ -175,7 +179,7 @@ class AccountController extends AbstractController $account = Account::where('id', $userInfo['userId'])->first(); $userId = $this->resetUserId($userInfo['userId']); $user = User::where('user_id', $userId)->first(['realname_flag', 'bind_card_flag', 'set_pwd_flag', 'mobile', 'real_name', 'certificate_no', 'user_type', 'apply_no', 'is_platform_account']); - $bankCard = BankCard::where('user_id', $userId)->first(['bank_name', 'card_user_name']); + $bankCard = BankCard::where('user_id', $userId)->first(['id', 'bank_name', 'card_user_name']); return $this->success(['username' => $account->username, 'userInfo' => $user, 'bankCard' => $bankCard]); } diff --git a/public/account.html b/public/account.html index c548806..b64e8f1 100644 --- a/public/account.html +++ b/public/account.html @@ -66,6 +66,7 @@ is_platform_account: '' }, bankCard: { + id: 0, bank_name: '', card_user_name: '' } @@ -165,7 +166,7 @@ console.log('submit!'); }, unbindCard() { - axios.post('/account/unbind-card', {token: window.sessionStorage.getItem('token')}) + axios.post('/account/unbind-card', {token: window.sessionStorage.getItem('token'), id: this.bankCard.id}) .then( (response) => { console.log(response); let result = response.data