mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 02:16:16 +08:00
* 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)
This commit is contained in:
parent
5a7084a8ab
commit
edd6a86d12
@ -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…
x
Reference in New Issue
Block a user