2026-06-30 24681c81c09022f584a57006f2534b5f74723414
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package cn.iocoder.yudao.module.im.service.message;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.im.controller.admin.manager.message.vo.channel.ImChannelMessagePageReqVO;
import cn.iocoder.yudao.module.im.controller.admin.manager.message.vo.channel.ImChannelMessageSendReqVO;
import cn.iocoder.yudao.module.im.dal.dataobject.message.ImChannelMessageDO;
import jakarta.validation.Valid;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
/**
 * IM 频道消息 Service 接口
 *
 * @author 芋道源码
 */
public interface ImChannelMessageService {
 
    // ==================== 用户端 ====================
 
    /**
     * 拉取当前用户应收的频道消息(离线增量)
     *
     * @param userId 当前用户编号
     * @param minId  游标;返回大于此值的消息
     * @param size   返回条数
     * @return 频道消息列表;按 id 升序
     */
    List<ImChannelMessageDO> pullChannelMessageList(Long userId, Long minId, Integer size);
 
    /**
     * 上报频道消息已读位置;同步推 READ 事件给自己多端
     *
     * @param userId    当前用户编号
     * @param channelId 频道编号
     * @param messageId 已读到的最大消息编号
     */
    void readChannelMessages(Long userId, Long channelId, Long messageId);
 
    /**
     * 批量查询用户在多个频道下的已读游标
     *
     * @param userId     当前用户编号
     * @param channelIds 频道编号集合
     * @return channelId → 已读到的最大消息编号(未读到的频道不出现在返回 map 中)
     */
    Map<Long, Long> getChannelReadMaxMessageIdMap(Long userId, Collection<Long> channelIds);
 
    // ==================== 管理后台 ====================
 
    /**
     * 立即推送频道消息
     *
     * @param reqVO 推送请求
     * @return 消息编号
     */
    Long sendMessage(@Valid ImChannelMessageSendReqVO reqVO);
 
    /**
     * 分页查询消息
     *
     * @param reqVO 分页查询条件
     * @return 消息分页
     */
    PageResult<ImChannelMessageDO> getMessagePage(ImChannelMessagePageReqVO reqVO);
 
    /**
     * 删除消息
     *
     * @param id 消息编号
     */
    void deleteMessage(Long id);
 
}