fix: userIDs

pull/2608/head
icey-yu 1 year ago
parent d4fc77b556
commit 8658223c61

@ -1,6 +1,9 @@
package cachekey
import "time"
import (
"strings"
"time"
)
const (
OnlineKey = "ONLINE:"
@ -11,3 +14,7 @@ const (
func GetOnlineKey(userID string) string {
return OnlineKey + userID
}
func GetOnlineKeyUserID(key string) string {
return strings.TrimPrefix(key, OnlineKey)
}

@ -60,6 +60,7 @@ func (s *userOnline) GetAllOnlineUsers(ctx context.Context, cursor uint64) (map[
}
for _, key := range keys {
userID := cachekey.GetOnlineKeyUserID(key)
strValues, err := s.rdb.ZRange(ctx, key, 0, -1).Result()
if err != nil {
return nil, 0, err
@ -74,7 +75,7 @@ func (s *userOnline) GetAllOnlineUsers(ctx context.Context, cursor uint64) (map[
values = append(values, int32(intValue))
}
result[key] = values
result[userID] = values
}
return result, nextCursor, nil

Loading…
Cancel
Save