This commit is contained in:
邹宗楠
2023-03-27 09:55:35 +08:00
parent 9b0dd0eeac
commit 749106f5d6
2 changed files with 12 additions and 2 deletions

View File

@@ -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())

View File

@@ -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
})
}