Merge pull request 'feat-IRONFANS-122-Robin' (#532) from feat-IRONFANS-122-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/532
This commit is contained in:
chenhao 2024-06-13 17:08:50 +08:00
commit 049f42fa7d
2 changed files with 26 additions and 30 deletions

View File

@ -83,13 +83,11 @@ 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,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("ApiLogout failed!")
return
}
if _, ec = s.ApiLogout(ctx, &loginproto.ApiLogoutReq{
Mid: account.Mid,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("ApiLogout failed!")
return
}
}
@ -160,13 +158,11 @@ 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,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("ApiLogout failed!")
return
}
if _, ec = s.ApiLogout(ctx, &loginproto.ApiLogoutReq{
Mid: account.Mid,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("ApiLogout failed!")
return
}
}

View File

@ -563,14 +563,14 @@ func (s *Service) OpLoginByPswd(ctx *gin.Context, req *loginproto.OpLoginByPswdR
}
// 2.让已登录的用户强制下线
if util.DerefInt64(login.IsLogined) == 1 {
if _, ec = s.OpLogout(ctx, &loginproto.OpLogoutReq{
Mid: account.Mid,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("OpLogout failed!")
return
}
}
// if util.DerefInt64(login.IsLogined) == 1 {
// if _, ec = s.OpLogout(ctx, &loginproto.OpLogoutReq{
// Mid: account.Mid,
// }); ec != errcode.ErrCodeLoginSrvOk {
// logger.Error("OpLogout failed!")
// return
// }
// }
// 3.生成token
token, err := _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{
@ -634,14 +634,14 @@ func (s *Service) OpLoginByVeriCode(ctx *gin.Context, req *loginproto.OpLoginByV
}
// 4.让已登录的用户强制下线
if util.DerefInt64(login.IsLogined) == 1 {
if _, ec = s.OpLogout(ctx, &loginproto.OpLogoutReq{
Mid: account.Mid,
}); ec != errcode.ErrCodeLoginSrvOk {
logger.Error("OpLogout failed!")
return
}
}
// if util.DerefInt64(login.IsLogined) == 1 {
// if _, ec = s.OpLogout(ctx, &loginproto.OpLogoutReq{
// Mid: account.Mid,
// }); ec != errcode.ErrCodeLoginSrvOk {
// logger.Error("OpLogout failed!")
// return
// }
// }
// 5.生成token
token, err = _DefaultToken.OpGenerate(ctx, &tokenproto.OpCreateReq{