diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 6521ef93b..9585578ea 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -278,14 +278,16 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string if authType == "weixinmini" { appID := strings.Split(authSecret, ",")[0] if appID == "wx08a5c2a8581414ff" || appID == "wx2d6949f724b2541d" { //菜市或者果园 - binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", "wx2bb99eb5d2c9b82c") - if err != nil { - return authInfo, err - } - if len(binds) == 0 { - authInfo.IsExistOpenID = false - } else { - authInfo.IsExistOpenID = true + if user != nil { + binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", "wx2bb99eb5d2c9b82c") + if err != nil { + return authInfo, err + } + if len(binds) == 0 { + authInfo.IsExistOpenID = false + } else { + authInfo.IsExistOpenID = true + } } } }