fix(system/message): 修复全部已读无效

Closes #169
This commit is contained in:
2025-06-15 18:00:30 +08:00
parent 7bed5a51be
commit f44e0b0605

View File

@@ -76,7 +76,9 @@ public class MessageServiceImpl implements MessageService {
// 查询当前用户的未读消息
List<MessageDO> list = baseMapper.selectUnreadListByUserId(userId);
List<Long> unreadIds = list.stream().map(MessageDO::getId).toList();
messageLogService.addWithUserId(CollUtil.intersection(unreadIds, ids).stream().toList(), userId);
messageLogService.addWithUserId(CollUtil.isNotEmpty(ids)
? CollUtil.intersection(unreadIds, ids).stream().toList()
: unreadIds, userId);
WebSocketUtils.sendMessage(StpUtil.getTokenValueByLoginId(userId), String.valueOf(baseMapper
.selectUnreadListByUserId(userId)
.size()));