小程序登录判断,如果没有openid就做标记
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user