diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 482a9340..c61c389e 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -82,12 +82,14 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw } // 2.让已登录的用户强制下线 - 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 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 + } } } @@ -157,12 +159,14 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB } // 4.让已登录的用户强制下线 - 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 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 + } } }