feat(auth): 在登录响应中添加会话限制信息
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m32s

在LoginResponse结构体中新增Limit字段,用于返回用户最大会话数限制
修复userLoginLogic.go和telephoneLoginLogic.go中的缩进问题
This commit is contained in:
shanshanzhong 2025-11-26 22:57:10 -08:00
parent 7e32c571ab
commit 236fa6c4e6
5 changed files with 14 additions and 7 deletions

View File

@ -166,6 +166,7 @@ func (l *DeviceLoginLogic) DeviceLogin(req *types.DeviceLoginRequest) (resp *typ
loginStatus = true loginStatus = true
return &types.LoginResponse{ return &types.LoginResponse{
Token: token, Token: token,
Limit: l.svcCtx.Config.JwtAuth.MaxSessionsPerUser,
}, nil }, nil
} }

View File

@ -79,7 +79,10 @@ func (l *OAuthLoginGetTokenLogic) OAuthLoginGetToken(req *types.OAuthLoginGetTok
} }
loginStatus = true loginStatus = true
return &types.LoginResponse{Token: token}, nil return &types.LoginResponse{
Token: token,
Limit: l.svcCtx.Config.JwtAuth.MaxSessionsPerUser,
}, nil
} }
func (l *OAuthLoginGetTokenLogic) google(req *types.OAuthLoginGetTokenRequest, requestID, ip, userAgent string) (*user.User, error) { func (l *OAuthLoginGetTokenLogic) google(req *types.OAuthLoginGetTokenRequest, requestID, ip, userAgent string) (*user.User, error) {

View File

@ -166,5 +166,6 @@ func (l *TelephoneLoginLogic) TelephoneLogin(req *types.TelephoneLoginRequest, r
loginStatus = true loginStatus = true
return &types.LoginResponse{ return &types.LoginResponse{
Token: token, Token: token,
Limit: l.svcCtx.Config.JwtAuth.MaxSessionsPerUser,
}, nil }, nil
} }

View File

@ -121,5 +121,6 @@ func (l *UserLoginLogic) UserLogin(req *types.UserLoginRequest) (resp *types.Log
loginStatus = true loginStatus = true
return &types.LoginResponse{ return &types.LoginResponse{
Token: token, Token: token,
Limit: l.svcCtx.Config.JwtAuth.MaxSessionsPerUser,
}, nil }, nil
} }

View File

@ -1219,6 +1219,7 @@ type LoginLog struct {
type LoginResponse struct { type LoginResponse struct {
Token string `json:"token"` Token string `json:"token"`
Limit int64 `json:"limit"`
} }
type MessageLog struct { type MessageLog struct {