- 重构了dao.GetAuthBind和dao.GetUserBindAuthInfo
- AuthBind的唯一索引调整为"AuthID", "Type", "BindType", "DeletedAt"
This commit is contained in:
@@ -61,7 +61,7 @@ func (a *DefAuther) GetUserType() (userType int8) {
|
||||
func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []string, openID, unionID string, authDetail interface{}) (authBindEx *auth2.AuthBindEx, err error) {
|
||||
db := dao.GetDB()
|
||||
var authBind *model.AuthBind
|
||||
if authBind, err = dao.GetAuthBind(db, "", model.AuthBindTypeAuth, curAuthType, openID); err == nil { // 直接找到了
|
||||
if authBind, err = dao.GetAuthBind(db, model.AuthBindTypeAuth, curAuthType, openID); err == nil { // 直接找到了
|
||||
authBindEx = &auth2.AuthBindEx{
|
||||
AuthBind: *authBind,
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []st
|
||||
} else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID
|
||||
if unionID != "" { // 且有unionID
|
||||
var authBindList []*model.AuthBind
|
||||
if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionID, unionAuthTypeList); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
||||
if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, "", unionID); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
||||
authBind = authBindList[0]
|
||||
authBind.Type = curAuthType
|
||||
authBind.AuthID = openID
|
||||
|
||||
Reference in New Issue
Block a user