更新
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
import type { Conversation } from '@tencentcloud/lite-chat/basic';
|
||||
|
||||
/**
|
||||
* @description ConversationModel 主要负责会话操作和会话数据处理,ConversationModel 不需要开发者进行开发,由 TUIChatEngine 通过 {@link https://web.sdk.qcloud.com/im/doc/chat-engine/global.html#ConversationStore ConversationStore} 的 conversationList 提供给开发者直接使用。
|
||||
* @interface ConversationModel
|
||||
* @property {String} conversationID - 会话 ID。会话ID组成方式:<br/>
|
||||
* - `C2C${userID}`(单聊)
|
||||
* - `GROUP${groupID}`(群聊)
|
||||
* @property {String} type - 会话类型,具体如下:<br/>
|
||||
* | 类型 | 含义 |
|
||||
* | :--- | :---- |
|
||||
* | TUIChatEngine.TYPES.CONV_C2C | C2C(Client to Client, 端到端)会话 |
|
||||
* | TUIChatEngine.TYPES.CONV_GROUP | GROUP(群组)会话 |
|
||||
* | TUIChatEngine.TYPES.CONV_SYSTEM | SYSTEM(系统)会话。该会话只能接收来自系统的通知消息,不能发送消息。 |
|
||||
* @property {String} subType - 群组会话的群组类型,具体如下:<br/>
|
||||
* | 类型 | 含义 |
|
||||
* | :--- | :---- |
|
||||
* | TUIChatEngine.TYPES.GRP_WORK | 好友工作群 |
|
||||
* | TUIChatEngine.TYPES.GRP_PUBLIC | 陌生人社交群 |
|
||||
* | TUIChatEngine.TYPES.GRP_MEETING | 临时会议群 |
|
||||
* | TUIChatEngine.TYPES.GRP_AVCHATROOM | 直播群 |
|
||||
* @property {Number} unreadCount - 未读计数。TUIChatEngine.TYPES.GRP_MEETING / TUIChatEngine.TYPES.GRP_AVCHATROOM 类型的群组会话不记录未读计数,该字段值为0
|
||||
* @property {Object} lastMessage - 会话最新的消息
|
||||
* @property {String} lastMessage.nick - 群会话最新消息的发送者的昵称,C2C 会话为 ''
|
||||
* @property {String} lastMessage.nameCard - 群会话最新消息的发送者的群名片,C2C 会话为 ''
|
||||
* @property {Number} lastMessage.lastTime - 当前会话最新消息的时间戳,单位:秒
|
||||
* @property {Number} lastMessage.lastSequence - 当前会话的最新消息的 Sequence
|
||||
* @property {String} lastMessage.fromAccount - 最新消息来源用户的 userID
|
||||
* @property {Boolean} lastMessage.isRevoked - 会话最新的消息是否已被撤回,true 表示已撤回,默认值为 false
|
||||
* @property {String|null} lastMessage.revoker - 消息撤回者的 userID
|
||||
* @property {Boolean} lastMessage.isPeerRead - 对端是否已读 C2C 会话的最新消息,默认值为 false
|
||||
* @property {String} lastMessage.messageForShow - 最新消息的内容,用于展示。可能值:文本消息内容、"[图片]"、"[语音]"、"[位置]"、"[表情]"、"[文件]"、"[自定义消息]"。<br/>
|
||||
* 若该字段不满足您的需求,您可以使用 payload 来自定义渲染。
|
||||
* @property {String} lastMessage.type - 消息类型,具体如下:<br/>
|
||||
* | 类型 | 含义 |
|
||||
* | :--- | :---- |
|
||||
* | TUIChatEngine.TYPES.MSG_TEXT | 文本消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_IMAGE | 图片消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_SOUND | 音频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_AUDIO | 音频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_VIDEO | 视频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_FILE | 文件消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_LOCATION | 地理位置消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_CUSTOM | 自定义消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_GRP_TIP | 群提示消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_GRP_SYS_NOTICE | 群系统通知消息 |
|
||||
* @property {Object} lastMessage.payload - 消息的内容,收到的音频 / 文件消息的 payload 中没有 url 字段。
|
||||
* @property {Group} groupProfile - 群会话的群组资料
|
||||
* @property {Profile} userProfile - C2C会话的用户资料
|
||||
* @property {GroupAtInfo[]} groupAtInfoList - 群会话的 at 信息列表,接入侧可根据此信息在会话列表展示【有人@我】【@所有人】等效果。
|
||||
* @property {String} remark - 好友备注,只有C2C会话且对端是我的好友,且我设置过此好友的备注才有值
|
||||
* @property {Boolean} isPinned - 会话是否置顶
|
||||
* @property {String} messageRemindType - 消息提醒类型,具体如下:<br/>
|
||||
* - TUIChatEngine.TYPES.MSG_REMIND_ACPT_AND_NOTE 在线正常接收消息,离线时会有厂商的离线推送通知(Web 和小程序端无离线推送)
|
||||
* - TUIChatEngine.TYPES.MSG_REMIND_DISCARD 在线和离线都拒收消息
|
||||
* - TUIChatEngine.TYPES.MSG_REMIND_ACPT_NOT_NOTE 在线正常接收消息,离线不会有推送通知(消息免打扰)
|
||||
* @property {Array} markList - 会话标记列表,具体如下:<br/>
|
||||
* - TUIChatEngine.TYPES.CONV_MARK_TYPE_STAR 会话标星
|
||||
* - TUIChatEngine.TYPES.CONV_MARK_TYPE_UNREAD 会话标记未读(重要会话)
|
||||
* - TUIChatEngine.TYPES.CONV_MARK_TYPE_FOLD 会话折叠
|
||||
* - TUIChatEngine.TYPES.CONV_MARK_TYPE_HIDE 会话隐藏
|
||||
* @property {String} customData - 会话自定义数据
|
||||
* @property {Array} conversationGroupList - 会话所属分组列表
|
||||
* @property {String} draftText - 会话草稿
|
||||
* @property {Boolean} isMuted 会话是否已设置免打扰,默认为 false
|
||||
* @property {Number} operationType 群组操作类型, 默认 0。4-被踢出群组 5-群组被解散 8-主动退群
|
||||
*/
|
||||
export interface IConversationModel {
|
||||
conversationID: string;
|
||||
type: string;
|
||||
subType: string;
|
||||
unreadCount: number;
|
||||
lastMessage?: {
|
||||
nick: string;
|
||||
nameCard: string;
|
||||
lastTime: number | string;
|
||||
lastSequence: string;
|
||||
fromAccount: string;
|
||||
isRevoked: boolean;
|
||||
revoker?: string;
|
||||
isPeerRead: boolean;
|
||||
messageForShow: string;
|
||||
type: string;
|
||||
payload: any;
|
||||
};
|
||||
groupProfile?: any;
|
||||
userProfile?: any;
|
||||
groupAtInfoList?: any[];
|
||||
remark: string;
|
||||
isPinned: boolean;
|
||||
messageRemindType: string;
|
||||
markList: string[];
|
||||
customData: string;
|
||||
conversationGroupList: any[];
|
||||
draftText: string;
|
||||
isMuted: boolean;
|
||||
operationType: number; // 群组会话的操作类型
|
||||
_conversation: any; // 保存原始 conversation 实例数据
|
||||
|
||||
/**
|
||||
* 更新 conversationModel 属性
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
updateProperties(options: Conversation): void;
|
||||
|
||||
/**
|
||||
* 更新 operationType 属性
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
updateOperationType(operationType: number): void;
|
||||
|
||||
/**
|
||||
* 获取 IM SDK 提供的 conversation 对象
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
getConversation(): any;
|
||||
|
||||
// 以下方法用于处理 conversation 需要展示的数据
|
||||
/**
|
||||
* 获取会话头像
|
||||
* @function
|
||||
* @example
|
||||
* let avatar = conversationModel.getAvatar();
|
||||
*/
|
||||
getAvatar(): string;
|
||||
|
||||
/**
|
||||
* 获取会话名称
|
||||
* @function
|
||||
* @example
|
||||
* let name = conversationModel.getShowName();
|
||||
*/
|
||||
getShowName(): string;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type TencentCloudChat from '@tencentcloud/lite-chat/basic';
|
||||
/**
|
||||
* @description GroupModel 的属性与 IM SDK Group 属性字段保持一致,详情可参考:{@link https://web.sdk.qcloud.com/im/doc/zh-cn/Group.html Group}。
|
||||
* @interface GroupModel
|
||||
*/
|
||||
export interface IGroupModel {
|
||||
groupID: string;
|
||||
name: string;
|
||||
avatar: string;
|
||||
type: TencentCloudChat.TYPES.GRP_WORK
|
||||
| TencentCloudChat.TYPES.GRP_PUBLIC
|
||||
| TencentCloudChat.TYPES.GRP_MEETING
|
||||
| TencentCloudChat.TYPES.GRP_AVCHATROOM
|
||||
| TencentCloudChat.TYPES.GRP_COMMUNITY;
|
||||
introduction: string;
|
||||
notification: string;
|
||||
ownerID: string;
|
||||
createTime: number;
|
||||
infoSequence?: number;
|
||||
lastInfoTime?: number;
|
||||
selfInfo?: {
|
||||
role?: string;
|
||||
messageRemindType?: string;
|
||||
joinTime?: number;
|
||||
nameCard?: string;
|
||||
userID?: string;
|
||||
memberCustomField?: any[];
|
||||
};
|
||||
lastMessage?: any;
|
||||
nextMessageSeq: number;
|
||||
memberCount: number;
|
||||
maxMemberCount: number;
|
||||
muteAllMembers: boolean;
|
||||
joinOption: string;
|
||||
groupCustomField?: any[];
|
||||
isSupportTopic: boolean;
|
||||
groupAttributes: any;
|
||||
groupCounters: any;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './conversation';
|
||||
export * from './group';
|
||||
export * from './message';
|
||||
@@ -0,0 +1,326 @@
|
||||
import type { Message } from '@tencentcloud/lite-chat/basic';
|
||||
import type TencentCloudChat from '@tencentcloud/lite-chat/basic';
|
||||
import type { ModifyMessageParams, ReactionInfo } from '../../type';
|
||||
|
||||
/**
|
||||
* @description MessageModel 主要负责消息操作和消息上屏数据处理,MessageModel 不需要开发者进行开发,由 TUIChatEngine 通过 {@link https://web.sdk.qcloud.com/im/doc/chat-engine/global.html#ChatStore ChatStore} 的 messageList 提供给开发者直接使用。<br/>
|
||||
* @interface IMessageModel
|
||||
* @property {String} ID - 消息 ID
|
||||
* @property {String} type - 消息类型,具体如下:<br/>
|
||||
* | 类型 | 含义 |
|
||||
* | :--- | :---- |
|
||||
* | TUIChatEngine.TYPES.MSG_TEXT | 文本消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_IMAGE | 图片消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_SOUND | 音频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_AUDIO | 音频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_VIDEO | 视频消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_FILE | 文件消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_CUSTOM | 自定义消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_MERGER | 合并消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_LOCATION | 位置消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_FACE | 表情消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_GRP_TIP | 群提示消息 |
|
||||
* | TUIChatEngine.TYPES.MSG_GRP_SYS_NOTICE | 群系统通知消息 |
|
||||
* @property {Object} payload - 消息的内容,详细内容请查看: [Message](https://web.sdk.qcloud.com/im/doc/v3/zh-cn/Message.html)
|
||||
* @property {String} conversationID - 消息所属的会话 ID
|
||||
* @property {String} conversationType - 消息所属会话的类型,具体如下:<br/>
|
||||
* | 类型 | 含义 |
|
||||
* | :--- | :---- |
|
||||
* | TUIChatEngine.TYPES.CONV_C2C | C2C(Client to Client, 端到端) 会话 |
|
||||
* | TUIChatEngine.TYPES.CONV_GROUP | GROUP(群组) 会话 |
|
||||
* | TUIChatEngine.TYPES.CONV_SYSTEM | SYSTEM(系统) 会话 |
|
||||
* @property {String} to - 接收方的 userID
|
||||
* @property {String} from - 发送方的 userID,在消息发送时,会默认设置为当前登录的用户
|
||||
* @property {String} flow - 消息的流向<br/>
|
||||
* - in 为收到的消息
|
||||
* - out 为发出的消息
|
||||
* @property {Number} time - 消息时间戳。单位:秒
|
||||
* @property {String} status - 消息状态
|
||||
* - unSend(未发送)
|
||||
* - success(发送成功)
|
||||
* - fail(发送失败)
|
||||
* @property {Boolean} isRevoked =false - 是否被撤回的消息,true 标识被撤回的消息
|
||||
* @property {String} priority=TUIChatEngineTYPES.MSG_PRIORITY_NORMAL - 消息优先级,用于群聊
|
||||
* @property {String} nick='' 消息发送者的昵称(在 AVChatRoom 内支持,需提前调用 [TUIUserService.updateMyProfile](https://web.sdk.qcloud.com/im/doc/chat-engine/ITUIUserService.html#updateMyProfile) 设置)
|
||||
* @property {String} avatar='' 消息发送者的头像地址(在 AVChatRoom 内支持,需提前调用 [TUIUserService.updateMyProfile](https://web.sdk.qcloud.com/im/doc/chat-engine/ITUIUserService.html#updateMyProfile) 设置)
|
||||
* @property {Boolean} isPeerRead=false - C2C 消息对端是否已读,true 标识对端已读
|
||||
* @property {String} nameCard='' 非直播群消息发送者的群名片(也可称之为消息发送者的群昵称),需提前调用 [TUIGroupService.setGroupMemberNameCard](https://web.sdk.qcloud.com/im/doc/chat-engine/ITUIGroupService.html#setGroupMemberNameCard) 设置
|
||||
* @property {Array} atUserList 群聊时此字段存储被 at 的群成员的 userID
|
||||
* @property {String} cloudCustomData='' - 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到)
|
||||
* @property {Boolean} isDeleted=false - 是否被删除的消息,true 标识被删除的消息
|
||||
* @property {Boolean} isModified=false - 是否被修改过,true 标识被修改过的消息
|
||||
* @property {Boolean} needReadReceipt=false - 是否需要已读回执,true 标识需要(需要您购买旗舰版套餐)
|
||||
* @property {Object} readReceiptInfo={readCount,unreadCount,isPeerRead} - 消息已读回执信息
|
||||
* @property {Number|undefined} readReceiptInfo.readCount - 群消息已读数<br/>
|
||||
* 如果想要查询哪些群成员已读了消息,可调用 [TUIChatService.getGroupMessageReadMemberList](https://web.sdk.qcloud.com/im/doc/chat-engine/ITUIChatService.html#getGroupMessageReadMemberList)
|
||||
* @property {Number|undefined} readReceiptInfo.unreadCount - 群消息未读数
|
||||
* @property {Boolean|undefined} readReceiptInfo.isPeerRead - C2C消息对端是否已发送已读回执,消息发送方收到已读回执通知或拉漫游时会更新此属性
|
||||
* @property {Boolean} isBroadcastMessage=false - 对所有直播群广播消息,true 标识直播群广播消息(需要您购买旗舰版套餐)
|
||||
* @property {Boolean} isSupportExtension=false - 是否支持消息扩展,true 支持 false 不支持(需要您购买旗舰版套餐)
|
||||
* @property {String|null} revoker - 消息撤回者的 userID
|
||||
* @property {Number} progress - 图片、视频、语音、文件消息上传进度, 默认 0
|
||||
* @property {Object} revokerInfo - 消息撤回者的信息。
|
||||
* @property {String} revokerInfo.avatar - 消息撤回者的头像
|
||||
* @property {String} revokerInfo.nick - 消息撤回者的昵称
|
||||
* @property {String} revokerInfo.userID - 消息撤回者的 userID
|
||||
* @property {String} revokeReason - 消息撤回的原因。
|
||||
* @property {Boolean} hasRiskContent - 语音、视频消息是否被标记为有安全风险的消息,默认为 false。
|
||||
* - 只有在开通【云端审核】功能后才生效,【云端审核】开通流程请参考 [云端审核功能](https://cloud.tencent.com/document/product/269/83795#.E4.BA.91.E7.AB.AF.E5.AE.A1.E6.A0.B8.E5.8A.9F.E8.83.BD)。
|
||||
* @property {Array<ReactionInfo>} reactionList - 需要您购买旗舰版才支持此功能,购买旗舰版能力并重新登录后,拉漫游时会自动获取表情回复摘要信息。
|
||||
*/
|
||||
export interface IMessageModel {
|
||||
ID: string;
|
||||
type: TencentCloudChat.TYPES;
|
||||
payload: any;
|
||||
conversationID: string;
|
||||
conversationType: TencentCloudChat.TYPES;
|
||||
to: string;
|
||||
from: string;
|
||||
flow: string;
|
||||
time: number;
|
||||
status: string;
|
||||
isRevoked: boolean;
|
||||
priority: TencentCloudChat.TYPES;
|
||||
nick: string;
|
||||
avatar: string;
|
||||
isPeerRead: boolean;
|
||||
nameCard: string;
|
||||
atUserList: string[];
|
||||
cloudCustomData: string;
|
||||
isDeleted: boolean;
|
||||
isModified: boolean;
|
||||
needReadReceipt: boolean;
|
||||
readReceiptInfo: any;
|
||||
isBroadcastMessage: boolean;
|
||||
isSupportExtension: boolean;
|
||||
receiverList?: string[];
|
||||
revoker: string;
|
||||
sequence: number;
|
||||
progress: number;
|
||||
revokerInfo: { userID: string; nick: string; avatar: string };
|
||||
revokeReason: string;
|
||||
hasRiskContent: boolean;
|
||||
reactionList: ReactionInfo[];
|
||||
|
||||
/**
|
||||
* 更新 messageModel 属性
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
updateProperties(options: Message): void;
|
||||
|
||||
/**
|
||||
* 获取 Chat SDK 提供的 message 实例
|
||||
* @function
|
||||
* @private
|
||||
* @example
|
||||
* let message = messageModel.getMessage();
|
||||
*/
|
||||
getMessage(): Message;
|
||||
|
||||
/**
|
||||
* 修改消息
|
||||
*
|
||||
* @param {ModifyMessageParams} options 修改的内容
|
||||
* @function
|
||||
* @example
|
||||
* let promise = messageModel.modifyMessage(options);
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
modifyMessage(options: ModifyMessageParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 撤回单聊消息或者群聊消息。撤回成功后,消息对象的 isRevoked 属性值为 true。
|
||||
* @function
|
||||
* @example
|
||||
* let promise = messageModel.revokeMessage();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
revokeMessage(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 重发消息的接口,当消息发送失败时,可调用该接口进行重发
|
||||
* @function
|
||||
* @example
|
||||
* let promise = messageModel.resendMessage();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
resendMessage(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 删除消息的接口。删除成功后,被删除消息的 isDeleted 属性值为 true。
|
||||
* @function
|
||||
* @example
|
||||
* let promise = messageModel.deleteMessage();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
deleteMessage(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 引用当前消息
|
||||
* @function
|
||||
* @example
|
||||
* let message = messageModel.quoteMessage();
|
||||
*/
|
||||
quoteMessage(): Message;
|
||||
|
||||
/**
|
||||
* 回复当前消息
|
||||
* @function
|
||||
* @example
|
||||
* let message = messageModel.replyMessage();
|
||||
*/
|
||||
replyMessage(): Message;
|
||||
|
||||
/**
|
||||
* 设置消息扩展
|
||||
* @function
|
||||
* @param {Array<object>} extensions 扩展信息
|
||||
* @private
|
||||
* @example
|
||||
* let promise = messageModel.setMessageExtensions([
|
||||
* { key: 'a', value: '1' },
|
||||
* { key: 'b', value: '2' }
|
||||
* ]);
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setMessageExtensions(extensions: object[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* 删除消息扩展
|
||||
* @function
|
||||
* @param {Array<string>|undefined} keyList 消息扩展 key 列表,不传 keyList 表示删除所有扩展 key
|
||||
* @private
|
||||
* @example
|
||||
* // 删除部分 key
|
||||
* let promise = messageModel.deleteMessageExtensions(['a', 'b']);
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
* // 删除全部 key
|
||||
* let promise = messageModel.deleteMessageExtensions();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
deleteMessageExtensions(keyList?: string[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取消息扩展
|
||||
* @function
|
||||
* @private
|
||||
* @example
|
||||
* let promise = messageModel.getMessageExtensions();
|
||||
* promise.then((chatResponse) => {
|
||||
* // 消息扩展信息
|
||||
* const { extensions } = chatResponse.data;
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getMessageExtensions(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取信令信息
|
||||
* @function
|
||||
* @example
|
||||
* let signaling = messageModel.getSignalingInfo();
|
||||
* // signaling != null 说明是信令消息,可以进行信令相关的业务逻辑处理
|
||||
* // signaling = null 说明是非信令消息
|
||||
* if (signaling) {
|
||||
* console.log(signaling)
|
||||
* }
|
||||
*/
|
||||
getSignalingInfo(): Record<string, any> | null;
|
||||
|
||||
/**
|
||||
* 获取消息展示内容 <br/>
|
||||
* 注意1:以下解析为默认解析行为,如果需要自定义解析,可以通过 messageModel 结构体内容自行解析。<br/>
|
||||
* 注意2:该接口不支持群系统消息解析。<br/>
|
||||
* 注意3:群提示消息不支持返回 showName。<br/>
|
||||
* 注意4:showName 显示优先级如下:
|
||||
* - 单聊:remark > nick > userID
|
||||
* - 群聊:remark > nameCard > nick > userID
|
||||
* @function
|
||||
* @example
|
||||
* // 文本消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.text - 文本消息展示内容
|
||||
* // result.name - 文本消息名称,值为 text 或 img, 返回 img 时标识是 emoji 表情消息
|
||||
* // result.type - 文本消息类型,自定义 emoji 表情消息时返回 custom,UIKit 默认的 emoji 表情和普通文本消息不返回 type 字段(v2.2.0 起支持)
|
||||
* // result.emojiKey - emoji 表情的 key(v2.2.0 起支持)
|
||||
* // result.src - emoji 表情消息展示链接,type = custom 时返回空字符串,需要 UIKit 层根据 baseUrl 和 emojiKey 拼接完整链接
|
||||
* @example
|
||||
* // 表情消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.name - 表情消息名称
|
||||
* // retsult.type - 表情消息类型,自定义 face 表情消息时返回 custom,UIKit 默认 face 表情包 type 返回 ‘’(v2.2.0 起支持)
|
||||
* // result.url - 表情消息展示链接,type = custom 时返回空字符串,需要 UIKit 层根据 baseUrl 和 name 拼接完整链接
|
||||
* @example
|
||||
* // 地理位置消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.lon - 经度
|
||||
* // result.lat - 纬度
|
||||
* // result.href - 地图跳转链接
|
||||
* // result.url - 地图展示链接
|
||||
* // result.description - 描述信息
|
||||
* @example
|
||||
* // 图片消息返回结果,默认返回的是原图信息,如果需要缩略图或大图信息请从 messageModel.payload 中获取
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.url - 图片访问链接
|
||||
* // result.width - 图片宽度
|
||||
* // result.width - 图片高度
|
||||
* @example
|
||||
* // 语音消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.url - 语音播放链接
|
||||
* // result.second - 语音时长
|
||||
* @example
|
||||
* // 视频消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.url - 视频播放链接
|
||||
* // result.snapshotUrl - 视频封面图链接
|
||||
* // result.snapshotWidth - 视频封面图宽度
|
||||
* // result.snapshotHeight - 视频封面图高度
|
||||
* @example
|
||||
* // 文件消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.url - 文件下载链接
|
||||
* // result.name - 文件名称
|
||||
* // result.size - 文件大小
|
||||
* @example
|
||||
* // 自定义消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // result.custom - 自定义消息展示内容
|
||||
* // result.businessID - 业务标识信息,创建群组自定义消息的 businessID 是 group_create,其他的自定义消息返回为空字符串
|
||||
* @example
|
||||
* // 合并消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.showName - 消息发送方名称
|
||||
* // 合并消息返回内容是 message.payload 内容
|
||||
* @example
|
||||
* // 群提示消息返回结果
|
||||
* const result = messageModel.getMessageContent();
|
||||
* // result.text - 群提示消息展示内容
|
||||
*/
|
||||
getMessageContent(): Record<string, any>;
|
||||
}
|
||||
Reference in New Issue
Block a user