From 749106f5d6e7fdb475680b0bcdedd53e6e08332a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 27 Mar 2023 09:55:35 +0800 Subject: [PATCH] 1 --- business/auth2/auth2.go | 2 +- controllers/auth2.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 64d843b4b..1ab4c6c7f 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -427,7 +427,7 @@ func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) { if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil { user, err := dao.GetUserByID(dao.GetDB(), "mobile", mobile) if err != nil { - return errors.New("此接口有执行顺序,请先调用注册登录接口:【第一步:Login,第二不:TiktokDecrypt】") + return errors.New("此接口有执行顺序,请先调用注册登录接口:【第一步:Login,第二步:TiktokDecrypt】") } authInfo.AuthBindInfo.UserID = user.UserID //handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName()) diff --git a/controllers/auth2.go b/controllers/auth2.go index 307d2543a..3410ddc21 100644 --- a/controllers/auth2.go +++ b/controllers/auth2.go @@ -100,7 +100,17 @@ func (c *Auth2Controller) SendVerifyCode() { func (c *Auth2Controller) TiktokDecrypt() { c.callTiktokDecrypt(func(params *tAuth2TiktokDecryptParams) (interface{}, string, error) { phone, err := auth2.DecryptUserMsg(params.SessionKey, params.Iv, params.Msg, params.LoginType) - return phone, "", err + isExist := false + if phone != "" { + if user, err := dao.GetUserByID(dao.GetDB(), "mobile", phone); err == nil { + if user != nil { + isExist = true + } else { + isExist = false + } + } + } + return map[string]interface{}{"mobile": phone, "isExist": isExist}, "", err }) }