用户修改属性时的最后修改人从jxadmin改为用户id
用户注册时也记录相应的最后登录信息
This commit is contained in:
@@ -55,7 +55,7 @@ func (*UserProvider) GetUser(authID, authIDType string) (user auth2.IUser) {
|
||||
func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error) {
|
||||
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
||||
"Mobile": mobile,
|
||||
}, model.AdminName, map[string]interface{}{
|
||||
}, userID, map[string]interface{}{
|
||||
"UserID": userID,
|
||||
})
|
||||
return err
|
||||
@@ -64,7 +64,7 @@ func (*UserProvider) UpdateUserMobile(userID string, mobile string) (err error)
|
||||
func (*UserProvider) UpdateUserEmail(userID string, email string) (err error) {
|
||||
_, err = dao.UpdateEntityLogically(dao.GetDB(), &model.User{}, map[string]interface{}{
|
||||
"Email": email,
|
||||
}, model.AdminName, map[string]interface{}{
|
||||
}, userID, map[string]interface{}{
|
||||
"UserID": userID,
|
||||
})
|
||||
return err
|
||||
@@ -83,7 +83,8 @@ func (*UserProvider) UpdateUserType(userID string, userTypeMask int8, updateType
|
||||
} else {
|
||||
user.Type = userTypeMask
|
||||
}
|
||||
_, err = dao.UpdateEntity(db, user, "Type")
|
||||
dao.WrapUpdateULEntity(user, userID)
|
||||
_, err = dao.UpdateEntity(db, user, "Type", model.FieldUpdatedAt, model.FieldLastOperator)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,7 +94,7 @@ func (*UserProvider) UpdateLastLogin(userID string, lastLoginType, fromIP string
|
||||
"LastLoginAt": utils.Time2Pointer(time.Now()),
|
||||
"LastLoginType": lastLoginType,
|
||||
"LastLoginIP": fromIP,
|
||||
}, model.AdminName, map[string]interface{}{
|
||||
}, userID, map[string]interface{}{
|
||||
"UserID": userID,
|
||||
})
|
||||
return err
|
||||
@@ -126,6 +127,7 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
|
||||
user.Type |= model.UserTypeStoreBoss
|
||||
}
|
||||
if err = CreateUser(user, utils.LimitUTF8StringLen(ctx.GetRealRemoteIP()+","+inAuthInfo.GetAuthID(), 32)); err == nil {
|
||||
userProvider.UpdateLastLogin(user.GetID(), inAuthInfo.GetAuthType(), ctx.GetRealRemoteIP())
|
||||
TryAddStoreBossRole4User(ctx, user)
|
||||
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
||||
err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo)
|
||||
|
||||
Reference in New Issue
Block a user