by Robin at 20240613 #531

Merged
chenhao merged 1 commits from feat-IRONFANS-122-Robin into test 2024-06-13 13:21:01 +08:00
1 changed files with 16 additions and 12 deletions

View File

@ -80,6 +80,7 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw
}
// 2.让已登录的用户强制下线
if account.GetRole() == consts.User {
if util.DerefInt64(login.IsLogined) == 1 {
if _, ec = s.ApiLogout(ctx, &loginproto.ApiLogoutReq{
Mid: account.Mid,
@ -88,6 +89,7 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw
return
}
}
}
// 3.生成token
token, err := _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{
@ -155,6 +157,7 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
}
// 4.让已登录的用户强制下线
if account.GetRole() == consts.User {
if util.DerefInt64(login.IsLogined) == 1 {
if _, ec = s.ApiLogout(ctx, &loginproto.ApiLogoutReq{
Mid: account.Mid,
@ -163,6 +166,7 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
return
}
}
}
// 5.生成token
token, err = _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{