diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php index 9cab875..bc2b285 100644 --- a/app/Controller/Payment/AccountController.php +++ b/app/Controller/Payment/AccountController.php @@ -111,6 +111,33 @@ class AccountController extends AbstractController return $this->success(['url' => $url]); } + public function unbindCard(RequestInterface $request) + { + $userInfo = $this->checkUser($request); + $userId = $this->resetUserId($userInfo['userId']); + $requestLog = $this->createRequestLog(['userId' => $userId]); + $result = $this->userService->unbindCard($requestLog->getData(), $requestLog->app); + return $this->success(['result' => $result]); + } + + public function setPayPassword(RequestInterface $request) + { + $userInfo = $this->checkUser($request); + $userId = $this->resetUserId($userInfo['userId']); + $requestLog = $this->createRequestLog(['userId' => $userId]); + $url = $this->userService->pwdForget($requestLog->getData(), $requestLog->app, $requestLog->request_token); + return $this->success(['url' => $url]); + } + + public function resetPayPassword(RequestInterface $request) + { + $userInfo = $this->checkUser($request); + $userId = $this->resetUserId($userInfo['userId']); + $requestLog = $this->createRequestLog(['userId' => $userId]); + $url = $this->userService->pwdModify($requestLog->getData(), $requestLog->app, $requestLog->request_token); + return $this->success(['url' => $url]); + } + public function transferPay(RequestInterface $request) { $userInfo = $this->checkUser($request); diff --git a/config/routes.php b/config/routes.php index ce79a59..ca5b8b6 100644 --- a/config/routes.php +++ b/config/routes.php @@ -42,6 +42,9 @@ Router::addGroup('/account',function () { Router::post('/register', [AccountController::class, 'register']); Router::post('/open-account', [AccountController::class, 'openAccount']); Router::post('/bind-card', [AccountController::class, 'bindCard']); + Router::post('/unbind-card', [AccountController::class, 'unBindCard']); + Router::post('/set-pay-password', [AccountController::class, 'setPayPassword']); + Router::post('/reset-pay-password', [AccountController::class, 'resetPayPassword']); Router::post('/transfer-pay', [AccountController::class, 'transferPay']); Router::post('/user-info', [AccountController::class, 'getUserInfo']); }, []); diff --git a/public/account.html b/public/account.html index 0a20011..9ca4b4b 100644 --- a/public/account.html +++ b/public/account.html @@ -24,16 +24,16 @@ 开户 {{userInfo.certificate_no}} -- - ********** 修改 - 设置 + ********** 修改 + 设置 - {{bankCard.bank_name}} 解绑 - 绑卡 + {{bankCard.bank_name}} 解绑 + 绑卡 {{bankCard.card_user_name}} -- @@ -116,21 +116,63 @@ }); console.log('submit!'); }, + resetPayPassword() { + axios.post('/account/reset-pay-password', {token: window.sessionStorage.getItem('token')}) + .then( (response) => { + console.log(response); + let result = response.data + if (result.code != 1000) { + return this.$message.error(response.data.message); + } + window.open(result.data.url) + }) + .catch((error) => { + this.$message.error('请求错误'); + console.log(error); + }); + console.log('submit!'); + }, + setPayPassword() { + axios.post('/account/set-pay-password', {token: window.sessionStorage.getItem('token')}) + .then( (response) => { + console.log(response); + let result = response.data + if (result.code != 1000) { + return this.$message.error(response.data.message); + } + window.open(result.data.url) + }) + .catch((error) => { + this.$message.error('请求错误'); + console.log(error); + }); + console.log('submit!'); + }, bindCard() { - axios.post('/account/bind-card', this.bindConfirmForm) + axios.post('/account/bind-card', {token: window.sessionStorage.getItem('token')}) .then( (response) => { console.log(response); let result = response.data if (result.code != 1000) { return this.$message.error(response.data.message); } - this.bindConfirmVisible = false; - this.$message.success('支付成功'); - this.$alert('请记住您的订单号:' + result.data.bizData.outOrderNo , '支付成功', { - confirmButtonText: '确定', - callback: action => { - } - }); + window.open(result.data.url) + }) + .catch((error) => { + this.$message.error('请求错误'); + console.log(error); + }); + console.log('submit!'); + }, + unbindCard() { + axios.post('/account/unbind-card', {token: window.sessionStorage.getItem('token')}) + .then( (response) => { + console.log(response); + let result = response.data + if (result.code != 1000) { + return this.$message.error(response.data.message); + } + window.location.href = window.location.href; }) .catch((error) => { this.$message.error('请求错误');