diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 0699af181..a120a1246 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -274,6 +274,21 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string if user != nil && user.GetID() != "" { userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) } + //如果是小程序 + if authType == "weixinmini" { + appID := strings.Split(authSecret, ",")[0] + if appID == "wx08a5c2a8581414ff" || appID == "wx2d6949f724b2541d" { //菜市或者果园 + binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", "weixinsns") + if err != nil { + return authInfo, err + } + if len(binds) == 0 { + authInfo.IsExistOpenID = false + } else { + authInfo.IsExistOpenID = true + } + } + } } } else { err = ErrIllegalAuthType diff --git a/business/auth2/auth_info.go b/business/auth2/auth_info.go index 7ca58252d..2cf07072d 100644 --- a/business/auth2/auth_info.go +++ b/business/auth2/auth_info.go @@ -69,10 +69,11 @@ type AuthInfo struct { UserBasic // 登录成功后保存的用户信息 AuthBindInfo *AuthBindEx `json:"authBindInfo"` - LoginTime time.Time `json:"loginTime"` - ExpiresAt int64 `json:"expiresAt"` - Token string `json:"token"` - TokenType int `json:"tokenType"` // TOKEN类型, + LoginTime time.Time `json:"loginTime"` + ExpiresAt int64 `json:"expiresAt"` + Token string `json:"token"` + TokenType int `json:"tokenType"` // TOKEN类型, + IsExistOpenID bool `json:"isExistOpenID"` } func (a *AuthInfo) GetAuthID() string {