- 添加用户最后登录信息
This commit is contained in:
@@ -3,6 +3,7 @@ package cms
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
|
||||
@@ -87,6 +88,17 @@ func (*UserProvider) UpdateUserType(userID string, userTypeMask int8, updateType
|
||||
return err
|
||||
}
|
||||
|
||||
func (*UserProvider) UpdateLastLogin(userID string, lastLoginType, fromIP string) (err error) {
|
||||
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
||||
"LastLoginAt": utils.Time2Pointer(time.Now()),
|
||||
"LastLoginType": lastLoginType,
|
||||
"LastLoginIP": fromIP,
|
||||
}, model.AdminName, map[string]interface{}{
|
||||
"UserID": userID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// func (*UserProvider) CreateUser(userID2, mobile, email, name string) (user auth2.IUser, err error) {
|
||||
// realUser := &model.User{
|
||||
// UserID2: userID2,
|
||||
@@ -102,7 +114,7 @@ func init() {
|
||||
}
|
||||
|
||||
func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVerifyCode string, inAuthInfo *auth2.AuthInfo) (outAuthInfo *auth2.AuthInfo, err error) {
|
||||
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, user.GetMobile(), auth2.UserIDMobile, mobileVerifyCode)
|
||||
mobileAuth, err2 := auth2.Login(ctx.Context, auth2.AuthTypeMobile, user.GetMobile(), auth2.UserIDMobile, mobileVerifyCode)
|
||||
if err = err2; err == nil {
|
||||
if !mobileAuth.IsUserEmpty() {
|
||||
return nil, jsonerr.New(mobileAuth, model.ErrCodeJsonUserAlreadyExist)
|
||||
|
||||
Reference in New Issue
Block a user