mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-01-09 13:36:57 +08:00
Get user online status
This commit is contained in:
parent
ac6e894ef8
commit
4b0cd42c1b
20
pkg/common/db/cache/user.go
vendored
20
pkg/common/db/cache/user.go
vendored
@ -174,15 +174,17 @@ func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([
|
|||||||
key := olineStatusKey + modKey
|
key := olineStatusKey + modKey
|
||||||
result, err := u.rdb.HGet(ctx, key, userID).Result()
|
result, err := u.rdb.HGet(ctx, key, userID).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
if err == redis.Nil {
|
||||||
} else if err == redis.Nil {
|
// key or field does not exist
|
||||||
// key or field does not exist
|
res = append(res, &user.OnlineStatus{
|
||||||
res = append(res, &user.OnlineStatus{
|
UserID: userID,
|
||||||
UserID: userID,
|
Status: 0,
|
||||||
Status: 0,
|
PlatformID: -1,
|
||||||
PlatformID: -1,
|
})
|
||||||
})
|
continue
|
||||||
continue
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = json.Unmarshal([]byte(result), &onlineStatus)
|
err = json.Unmarshal([]byte(result), &onlineStatus)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user