diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php index 955a0c9..eef72c7 100644 --- a/app/Controller/Payment/AccountController.php +++ b/app/Controller/Payment/AccountController.php @@ -10,6 +10,7 @@ use App\Helper\RedisKey; use App\Helper\StringHelper; use App\Model\Account; use App\Model\BankCard; +use App\Model\User; use Hyperf\HttpServer\Contract\RequestInterface; use App\Service\PaymentService; use App\Service\RequestService; @@ -137,4 +138,14 @@ class AccountController extends AbstractController $acsNo = $this->paymentService->transferPay($requestLog->getData(), $requestLog->app, $requestLog->request_token); return $this->success(['acsNo' => $acsNo]); } + + public function getUserInfo(RequestInterface $request) + { + $userInfo = $this->checkUser($request); + $account = Account::where('user_id', $userInfo['userId'])->first(); + $userId = 'ACT_' . $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']); + return $this->success(['username' => $account['username'], 'userInfo' => $user, $bankCard => $bankCard]); + } } diff --git a/config/routes.php b/config/routes.php index ac97e3a..ce79a59 100644 --- a/config/routes.php +++ b/config/routes.php @@ -43,6 +43,7 @@ Router::addGroup('/account',function () { Router::post('/open-account', [AccountController::class, 'openAccount']); Router::post('/bind-card', [AccountController::class, 'bindCard']); Router::post('/transfer-pay', [AccountController::class, 'transferPay']); + Router::post('/user-info', [AccountController::class, 'getUserInfo']); }, []); Router::addGroup('/notify',function () { diff --git a/public/account.html b/public/account.html index 7e90415..9ae4fbb 100644 --- a/public/account.html +++ b/public/account.html @@ -13,13 +13,31 @@ - kooriookami - 18100000000 - 苏州市 - - 学校 - - 江苏省苏州市吴中区吴中大道 1188 号 + {{username}} + {{userInfo.mobile}} + + + + + + + {{userInfo.real_name}} + -- + {{userInfo.certificate_no}} + -- + ********** + -- + {{userInfo.mobile}} + + + + + + + {{bankCard.bank_name}} + -- + {{bankCard.card_user_name}} + -- @@ -46,6 +64,21 @@ username: '', password: '', confirm_password: '' + }, + username: '', + userInfo: { + realname_flag: '', + bind_card_flag: '', + mobile: '', + real_name: '', + certificate_no: '', + user_type: '', + apply_no: '', + is_platform_account: '' + }, + bankCard: { + bank_name: '', + card_user_name: '' } } }, @@ -56,6 +89,24 @@ } }, methods: { + getUserInfo() { + axios.post('/account/user-info', {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.usernae = result.username; + this.userInfo = result.userInfo; + this.bankCard = result.bankCard; + }) + .catch((error) => { + this.$message.error('请求错误'); + console.log(error); + }); + console.log('submit!'); + }, bindCard() { axios.post('/account/bind-card', this.bindConfirmForm) .then( (response) => {