Merge pull request 'by Robin at 20240613' (#531) from feat-IRONFANS-122-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/531
This commit is contained in:
chenhao 2024-06-13 13:21:00 +08:00
commit 136f96fdf5
1 changed files with 16 additions and 12 deletions

View File

@ -82,6 +82,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,
@ -90,6 +91,7 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw
return
}
}
}
// 3.生成token
token, err := _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{
@ -157,6 +159,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,
@ -165,6 +168,7 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
return
}
}
}
// 5.生成token
token, err = _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{