- 添加用户最后登录信息
This commit is contained in:
@@ -65,6 +65,7 @@ type IUserProvider interface {
|
||||
UpdateUserMobile(userID string, mobile string) (err error)
|
||||
UpdateUserEmail(userID string, email string) (err error)
|
||||
UpdateUserType(userID string, userTypeMask int8, updateType int) (err error)
|
||||
UpdateLastLogin(userID string, lastLoginType, fromIP string) (err error)
|
||||
// CreateUser(userID2, mobile, email, name string) (user IUser, err error)
|
||||
}
|
||||
|
||||
@@ -222,7 +223,7 @@ func SendVerifyCode(authToken, captchaID, captchaValue, authID string) (err erro
|
||||
// 公众号登录:authIDTypeD是UserIDEmpty,authSecret是code(这个函数是被微信的回调调用,不是直接被客户端调用)
|
||||
// 微信登录:authIDType是UserIDEmpty,authSecret是code(这个函数是被微信的回调调用,不是直接被客户端调用)
|
||||
// 小程序登录:authIDType是UserIDEmpty,authSecret是jsCode
|
||||
func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, err error) {
|
||||
func Login(ctx *Context, authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, err error) {
|
||||
authType = strings.ToLower(authType)
|
||||
authIDType = strings.ToLower(authIDType)
|
||||
if handler := authers[authType]; handler != nil {
|
||||
@@ -266,6 +267,9 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo,
|
||||
}
|
||||
}
|
||||
authInfo = createAuthInfo(user, authBindEx)
|
||||
if user != nil && user.GetID() != "" {
|
||||
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = ErrIllegalAuthType
|
||||
|
||||
Reference in New Issue
Block a user