This commit is contained in:
suyl
2021-04-25 16:23:24 +08:00
parent 18ebaa41c4
commit 06a0332878
3 changed files with 37 additions and 0 deletions

View File

@@ -340,6 +340,18 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
return err
}
func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) {
if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil {
user, _ := dao.GetUserByID(dao.GetDB(), "mobile", mobile)
authInfo.AuthBindInfo.UserID = user.UserID
//handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
err = handler.AddAuthBind(authInfo.AuthBindInfo, user.GetName())
} else {
err = ErrIllegalAuthType
}
return err
}
func UnbindAuth(userID, authType, authTypeID, userName string) (err error) {
globals.SugarLogger.Debugf("UnbindAuth userID:%s, authType:%s, authTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
if handler := authers[authType]; handler != nil {