fix bug: obtain user online status err(#567) (#592)

* fix: implement of GetUsersOnlineStatus (#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)

* fix bug: obtain user online status err(#567)
pull/632/head
BanTanger 1 year ago committed by GitHub
parent 5a7084a8ab
commit edd6a86d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,7 +84,13 @@ func (u *UserApi) GetUsersOnlineStatus(c *gin.Context) {
reply, err := msgClient.GetUsersOnlineStatus(c, &req) reply, err := msgClient.GetUsersOnlineStatus(c, &req)
if err != nil { if err != nil {
log.ZWarn(c, "GetUsersOnlineStatus rpc err", err) log.ZWarn(c, "GetUsersOnlineStatus rpc err", err)
continue
parseError := apiresp.ParseError(err)
log.ZDebug(c, "errcode bantanger", "errcode", parseError.ErrCode)
if parseError.ErrCode == errs.NoPermissionError {
apiresp.GinError(c, err)
return
}
} else { } else {
wsResult = append(wsResult, reply.SuccessResult...) wsResult = append(wsResult, reply.SuccessResult...)
} }

@ -16,8 +16,9 @@ package msggateway
import ( import (
"context" "context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -82,6 +83,9 @@ func (s *Server) GetUsersOnlineStatus(
ctx context.Context, ctx context.Context,
req *msggateway.GetUsersOnlineStatusReq, req *msggateway.GetUsersOnlineStatusReq,
) (*msggateway.GetUsersOnlineStatusResp, error) { ) (*msggateway.GetUsersOnlineStatusResp, error) {
if !tokenverify.IsAppManagerUid(ctx) {
return nil, errs.ErrNoPermission.Wrap("only app manager")
}
var resp msggateway.GetUsersOnlineStatusResp var resp msggateway.GetUsersOnlineStatusResp
for _, userID := range req.UserIDs { for _, userID := range req.UserIDs {
clients, ok := s.LongConnServer.GetUserAllCons(userID) clients, ok := s.LongConnServer.GetUserAllCons(userID)

Loading…
Cancel
Save