【修复】IM:基于 offset 读取不到消息时,报 NPE 问题
This commit is contained in:
parent
f1731e4446
commit
2c5287a9b2
|
@ -33,10 +33,13 @@ public enum ImMessageContentTypeEnum implements IntArrayValuable {
|
|||
QUOTE(114, "引用消息"),
|
||||
FACE(115, "表情消息"),
|
||||
ADVANCED_REVOKE(118, "高级撤回消息"),
|
||||
|
||||
// ========== 好友通知 1200-1299 ===========
|
||||
FRIEND_ADDED(1201, "双方成为好友通知"),
|
||||
|
||||
// ========== 系统通知 1400 ==========
|
||||
OA_NOTIFICATION(1400, "系统通知"),
|
||||
|
||||
// ========== 群相关 1500-1599 ==========
|
||||
GROUP_CREATED(1501, "群创建通知"),
|
||||
GROUP_INFO_CHANGED(1502, "群信息改变通知"),
|
||||
|
@ -53,6 +56,7 @@ public enum ImMessageContentTypeEnum implements IntArrayValuable {
|
|||
GROUP_ANNOUNCEMENT_UPDATED(1519, "群公告改变通知"),
|
||||
GROUP_NAME_UPDATED(1520, "群名称改变通知"),
|
||||
|
||||
// TODO 芋艿:其它
|
||||
BURN_CHANGE(1701, "阅后即焚开启或关闭通知"),
|
||||
REVOKE(2101, "撤回消息通知");;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.im.service.message;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageListReqVO;
|
||||
import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSendReqVO;
|
||||
import cn.iocoder.yudao.module.im.dal.dataobject.group.ImGroupMemberDO;
|
||||
|
@ -19,6 +20,7 @@ import org.dromara.hutool.core.date.TimeUtil;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
@ -57,6 +59,9 @@ public class ImMessageServiceImpl implements ImMessageService {
|
|||
@Override
|
||||
public List<ImMessageDO> pullMessageList(Long userId, Long sequence, Integer size) {
|
||||
List<Long> messageIds = imInboxService.selectMessageIdsByUserIdAndSequence(userId, sequence, size);
|
||||
if (CollUtil.isEmpty(messageIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return imMessageMapper.selectBatchIds(messageIds);
|
||||
}
|
||||
|
||||
|
@ -70,6 +75,7 @@ public class ImMessageServiceImpl implements ImMessageService {
|
|||
}
|
||||
|
||||
private ImMessageDO saveMessage(Long fromUserId, ImMessageSendReqVO message) {
|
||||
// TODO 芋艿:消息格式的校验
|
||||
// 1. 校验接收人是否存在
|
||||
validateReceiverIdExists(message);
|
||||
// 2. 查询发送人信息
|
||||
|
|
Loading…
Reference in New Issue