diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index f3f340cc9..d553c1a32 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -174,6 +174,8 @@ func SendVerifyCode(authToken, captchaID, captchaValue, authID string) (err erro // 微信登录:authIDType是UserIDEmpty,authSecret是code(这个函数是被微信的回调调用,不是直接被客户端调用) // 小程序登录:authIDType是UserIDEmpty,authSecret是jsCode func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, err error) { + authType = strings.ToLower(authType) + authIDType = strings.ToLower(authIDType) if handler := authers[authType]; handler != nil { var authBind *model.AuthBind var user IUser diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index c91a710f4..75bfaf828 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -8,6 +8,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" + "git.rosy.net.cn/jx-callback/globals" ) var ( @@ -28,6 +29,7 @@ type UserProvider struct { } func (*UserProvider) GetUser(authID, authIDType string) (user auth2.IUser) { + globals.SugarLogger.Debugf("GetUser, authID:%s, authIDType:%s", authID, authIDType) fieldName := authTypeFieldMap[authIDType] if fieldName != "" { user2, err := dao.GetUserByID(dao.GetDB(), fieldName, authID) diff --git a/business/model/dao/dao_user2.go b/business/model/dao/dao_user2.go index c2b46b6a8..7d6846c6a 100644 --- a/business/model/dao/dao_user2.go +++ b/business/model/dao/dao_user2.go @@ -5,6 +5,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" + "git.rosy.net.cn/jx-callback/globals" ) func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err error) { @@ -13,7 +14,12 @@ func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err FROM user t1 WHERE t1.deleted_at = ? AND t1.%s = ? `, fieldName) - err = GetRow(db, &user, sql, utils.DefaultTimeValue, fieldValue) + sqlParams := []interface{}{ + utils.DefaultTimeValue, + fieldValue, + } + globals.SugarLogger.Debugf("GetUserByID sql:%s, sqlParams:%s", sql, utils.Format4Output(sql, false)) + err = GetRow(db, &user, sql, sqlParams...) return user, err } diff --git a/controllers/auth2.go b/controllers/auth2.go index 66a67750b..c52e9f131 100644 --- a/controllers/auth2.go +++ b/controllers/auth2.go @@ -54,7 +54,7 @@ func (c *Auth2Controller) SendVerifyCode() { // @Param authType formData string true "登录类型,当前支持[localpass:本地账号密码,mobile:手机短信,weixin:微信登录,weixinsns:微信公众号登录,weixinmini;小程序登录]" // @Param authSecret formData string true "不同登录类型的登录秘密,如果是localpass登录类型,是md5后的值(空串不要md5)" // @Param authID formData string false "登录ID,登录类型为localpass时依赖于authIDType,其它为相应登录类型的id" -// @Param authIDType formData string false "只有在登录类型为localpass时,才有意义,分别为:userID2:用户名,email,mobile" +// @Param authIDType formData string false "只有在登录类型为localpass时,才有意义,分别为:userid2:用户名,email,mobile" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /Login [post]