删除消息
超级群会话消息存储在服务端(免费存储 7 天)和用户设备本地数据库。App 用户通过客户端 SDK 删除自己的历史消息,支持仅从本地数据库删除消息、或仅从融云服务端删除消息。
提示
- 客户端的删除消息的操作均指从当前登录用户的历史消息记录中删除消息,不影响会话中其他用户的历史消息记录。
- 如果 App 的管理员或者某普通用户希望在该 App 中彻底删除一条消息,例如在所有超级群成员的聊天记录中删除一条消息,应使用客户端或服务端的撤回消息功能。消息成功撤回后,原始消息内容会在所有用户的本地与服务端历史消息记录中删除。
删除所有频道指定时间之前的消息
删除本地单个超级群所有频道指定时间之前的消息。
方法
C #
int clearUltraGroupMessagesForAllChannel(
string targetId,
int timestamp
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
targetId | string | 超级群 ID |
timestamp | int | 时间戳 |
返回值
返回值 | 描述 |
---|---|
int | 当次接口操作状态码,并不代表最终操作结果,状态码详细信息 |
代码示例
C #
int code = engine.clearUltraGroupMessagesForAllChannel(
targetId,
timestamp
);
回调方法
- onUltraGroupMessagesClearedForAllChannel
C #
delegate void OnUltraGroupMessagesClearedForAllChannelDelegate(
int code,
string targetId,
long timestamp);
OnUltraGroupMessagesClearedForAllChannelDelegate onUltraGroupMessagesClearedForAllChannel;
参数说明
参数 | 类型 | 说明 |
---|---|---|
code | int | 接口回调的状态码,0 代表成功,非 0 代表出现异常 |
targetId | string | 超级群ID |
timestamp | int | 时间戳 |
代码示例
C #
engine.onUltraGroupMessagesClearedForAllChannel = delegate(
int code,
string targetId,
int timestamp
)
{
}
删除特定频道指定时间之前的消息
删除本地单个超级群特定频道指定时间之前的消息。
方法
C #
int clearUltraGroupMessages(
string targetId,
string channelId,
int timestamp,
RCIMMessageOperationPolicy policy
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
targetId | string | 超级群 ID |
channelId | string | 频道ID |
timestamp | int | 时间戳 |
policy | RCIMMessageOperationPolicy | 删除策略 |
返回值
返回值 | 描述 |
---|---|
int | 当次接口操作状态码,并不代表最终操作结果,状态码详细信息 |
int的值参考状态码
代码示例
C #
int code = engine.clearUltraGroupMessages(
targetId,
channelId,
timestamp
);
回调方法
- onUltraGroupMessagesCleared
C #
delegate void OnUltraGroupMessagesClearedDelegate(int code,
string targetId,
string channelId,
long timestamp,
RCIMMessageOperationPolicy policy);
OnUltraGroupMessagesClearedDelegate onUltraGroupMessagesCleared;
参数说明
参数 | 类型 | 说明 |
---|---|---|
code | int | 接口回调的状态码,0 代表成功,非 0 代表出现异常 |
targetId | string | 超级群ID |
channelId | string | 频道ID |
timestamp | int | 时间戳 |
代码示例
C #
engine.onUltraGroupMessagesCleared = delegate(
int code,
string targetId,
string channelId,
int timestamp,
policy
)
{
}