From b6441121fbcebe710da6221d04a0ffad2ef4e075 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 13 Jun 2024 17:07:57 +0800 Subject: [PATCH 1/2] by Robin at 20240613 --- app/mix/service/apiservice.go | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index fce03e88..1aa4d3b7 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -81,13 +81,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 } } @@ -158,13 +156,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 } } From 61189f4bbe67e2ee78c17cc5ca7884a49ab38146 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 13 Jun 2024 17:08:29 +0800 Subject: [PATCH 2/2] by Robin at 20240613 --- app/mix/service/service.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/mix/service/service.go b/app/mix/service/service.go index f853d2e9..af7a6b6f 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -559,14 +559,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{ @@ -630,14 +630,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{