From 3aafc04f97f6ec929c7ac17095eee68705721e1d Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 17 Mar 2023 13:57:50 +0800 Subject: [PATCH] =?UTF-8?q?new:=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E8=AE=A4=E8=AF=81=E9=82=AE=E7=AE=B1=E7=9A=84?= =?UTF-8?q?=E5=80=9F=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/wallet.controller.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/controllers/wallet.controller.ts b/src/controllers/wallet.controller.ts index 511062d..2939870 100644 --- a/src/controllers/wallet.controller.ts +++ b/src/controllers/wallet.controller.ts @@ -24,6 +24,27 @@ class WalletController extends BaseController { return data } + @router('get /wallet/info/email') + async getEmailInfo(req, res) { + let user = req.user + if (user.emailReal && user.verified) { + return {email: user.emailReal, verified: 1} + } + if (user.email && user.emailVerified) { + if (!user.verified) { + user.verified = true + } + if (!user.emailReal) { + user.emailReal = user.email + } + if (!user.verified || !user.emailReal) { + await user.save() + } + return {email: user.email, verified: 1} + } + return {email: user.email || user.emailReal, verified: 0} + } + @router('post /wallet/info') async uploadWalletInfo(req, res) { let user = req.user