Skip to content

Commit

Permalink
Merge branch 'main' into fix-nil
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et authored Sep 27, 2024
2 parents e668f31 + aa1d311 commit 99a1248
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions internal/api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (u *UserApi) GetUsersOnlineTokenDetail(c *gin.Context) {
}

for _, v1 := range req.UserIDs {
m := make(map[string][]string, 10)
m := make(map[int32][]string, 10)
flag = false
temp := new(msggateway.SingleDetail)
for _, v2 := range wsResult {
Expand All @@ -162,17 +162,17 @@ func (u *UserApi) GetUsersOnlineTokenDetail(c *gin.Context) {
temp.UserID = v1
temp.Status = constant.OnlineStatus
for _, status := range v2.DetailPlatformStatus {
if v, ok := m[status.Platform]; ok {
m[status.Platform] = append(v, status.Token)
if v, ok := m[status.PlatformID]; ok {
m[status.PlatformID] = append(v, status.Token)
} else {
m[status.Platform] = []string{status.Token}
m[status.PlatformID] = []string{status.Token}
}
}
}
}
for p, tokens := range m {
t := new(msggateway.SinglePlatformToken)
t.Platform = p
t.PlatformID = p
t.Token = tokens
t.Total = int32(len(tokens))
temp.SinglePlatformToken = append(temp.SinglePlatformToken, t)
Expand Down
2 changes: 1 addition & 1 deletion internal/msggateway/hub_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *Server) GetUsersOnlineStatus(
}

ps := new(msggateway.GetUsersOnlineStatusResp_SuccessDetail)
ps.Platform = constant.PlatformIDToName(client.PlatformID)
ps.PlatformID = int32(client.PlatformID)
ps.Status = constant.OnlineStatus
ps.ConnID = client.ctx.GetConnID()
ps.Token = client.token
Expand Down

0 comments on commit 99a1248

Please sign in to comment.