- authType userID2 to userid2
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user