fix:bug修改
This commit is contained in:
1 parent
f2e2469b61
commit
00a0ab327c
8 files changed
+65
-2
No files matched your search
@@ -36,6 +36,10 @@ public class IMClient {
|
||||
return imSender.isOnline(userId,terminal);
|
||||
}
|
||||
|
||||
public Map<Long, Long> getLastActiveTime(List<Long> userIds) {
|
||||
return imSender.getLastActiveTime(userIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断多个用户是否在线
|
||||
|
||||
@@ -259,4 +259,20 @@ public class IMSender {
|
||||
public List<Long> getOnlineUser(List<Long> userIds) {
|
||||
return new LinkedList<>(getOnlineTerminal(userIds).keySet());
|
||||
}
|
||||
|
||||
public Map<Long, Long> getLastActiveTime(List<Long> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<Object> fields = userIds.stream().map(id -> (Object) String.valueOf(id)).toList();
|
||||
List<Object> values = redisMQTemplate.opsForHash().multiGet(IMRedisKey.IM_USER_LAST_ACTIVE, fields);
|
||||
Map<Long, Long> result = new HashMap<>();
|
||||
for (int i = 0; i < userIds.size(); i++) {
|
||||
Object value = values.get(i);
|
||||
if (value instanceof Number) {
|
||||
result.put(userIds.get(i), ((Number) value).longValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user