- fix bugs in auth2
This commit is contained in:
@@ -36,14 +36,14 @@ func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBind *model.AuthBin
|
||||
sessionInfo, err := api.WeixinMiniAPI.SNSCode2Session(jsCode)
|
||||
if err == nil {
|
||||
db := dao.GetDB()
|
||||
if authBind, err = dao.GetAuthBind(db, "", AuthTypeMP, sessionInfo.OpenID); dao.IsNoRowsError(err) {
|
||||
if authBind, err = dao.GetAuthBind(db, "", AuthTypeMini, sessionInfo.OpenID); dao.IsNoRowsError(err) {
|
||||
var authBindList []*model.AuthBind
|
||||
sessionKey := sessionInfo.SessionKey
|
||||
sessionInfo.SessionKey = ""
|
||||
if sessionInfo.UnionID != "" {
|
||||
if authBindList, err = dao.GetAuthBindsByAuthID2(db, sessionInfo.UnionID, []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini}); err == nil && len(authBindList) > 0 {
|
||||
if authBindList, err = dao.GetAuthBindsByAuthID2(db, sessionInfo.UnionID, []string{AuthTypeWeixin, AuthTypeMini, AuthTypeMini}); err == nil && len(authBindList) > 0 {
|
||||
authBind = authBindList[0]
|
||||
authBind.Type = AuthTypeMP
|
||||
authBind.Type = AuthTypeMini
|
||||
authBind.AuthID = sessionInfo.OpenID
|
||||
authBind.DetailData = string(utils.MustMarshal(sessionInfo))
|
||||
authBind.UserData = sessionKey
|
||||
@@ -54,7 +54,7 @@ func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBind *model.AuthBin
|
||||
}
|
||||
if err == nil && len(authBindList) == 0 {
|
||||
authBind = &model.AuthBind{
|
||||
Type: AuthTypeMP,
|
||||
Type: AuthTypeMini,
|
||||
AuthID: sessionInfo.OpenID,
|
||||
AuthID2: sessionInfo.UnionID,
|
||||
DetailData: string(utils.MustMarshal(sessionInfo)),
|
||||
|
||||
Reference in New Issue
Block a user