sysManage
- sysManage
- .sendRosterMessage(msg)
- .sendGroupMessage(msg)
- .requireHistoryMessage(uid, sid, amount)
- .sendMentionMessage(params)
- .sendInputStatusMessage(uid, status)
- .forwardMessage(param)
- .getMessageStatus(cid, mid, isGroup)
- .asyncFileUpload(param)
- .getImage(param)
- .deleteConversation(id, other_devices)
- .asyncGetGroupAvatarUploadUrl(params)
- .asyncGetFileUploadChatFileUrl(params)
sysManage.sendRosterMessage(msg) ⇒ number
发送单聊消息
Kind: static method of sysManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| msg | object |
消息体 |
| msg.uid | string |
接收者ID |
| msg.content | string |
消息内容 |
| msg.type | string |
消息类型: text - 文本, image - 图片, audio - 语音, video - 视频,file - 文件, location - 位置, command - 命令, forward - 转发 |
| msg.ext | string |
object |
| msg.attachment | string |
object |
sysManage.sendGroupMessage(msg) ⇒ number
发送群聊消息
Kind: static method of sysManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| msg | object |
发送消息体 |
| msg.gid | string |
群组ID |
| msg.content | string |
消息内容 |
| msg.type | string |
消息类型: text - 文本, image - 图片, audio - 语音, video - 视频,file - 文件, location - 位置, command - 命令, forward - 转发 |
| msg.ext | string |
object |
| msg.attachment | string |
object |
| msg.priority | number |
设置消息的扩散优先级,默认为0。0表示扩散,数字越小扩散的越多。 |
sysManage.requireHistoryMessage(uid, sid, amount)
请求历史消息
Kind: static method of sysManage
| Param | Type | Description |
|---|---|---|
| uid | number |
会话ID |
| sid | number |
消息ID: 从哪个消息向前拉取,传0表示从最新一条消息开始拉取。 |
| amount | number |
拉取的条数 |
sysManage.sendMentionMessage(params) ⇒ number
群发送@消息
Kind: static method of sysManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| params | object |
|
| params.gid | number |
群ID |
| params.txt | string |
消息文本内容 |
| params.mentionAll | boolean |
是否@所有人 |
| params.mentionList | Array.<number> |
@的成员ID列表 |
| params.mentionedMessage | string |
@消息的显示内容 |
| params.mentionedMessage | string |
@消息的推送内容 |
| params.senderNickname | string |
发送者昵称 |
sysManage.sendInputStatusMessage(uid, status) ⇒ number
发送输入状态消息
Kind: static method of sysManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| uid | number |
会话ID |
| status | string |
状态: nothing - 未输入, typing - 正在输入 |
sysManage.forwardMessage(param) ⇒ number
转发消息
Kind: static method of sysManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| param | object |
参数 |
| param.uid | number |
接收方用户ID(仅转发单聊时设置) |
| param.gid | number |
接收方群组ID(仅转发群聊时设置) |
| param.mid | number |
要转发的消息ID |
sysManage.getMessageStatus(cid, mid, isGroup) ⇒ string
获取消息的状态
Kind: static method of sysManage
Returns: string - 消息状态: unread - 未读, delivered - 已投递, read - 已读
| Param | Type | Default | Description |
|---|---|---|---|
| cid | number |
会话ID | |
| mid | number |
消息ID | |
| isGroup | boolean |
false |
是否是群聊 |
sysManage.asyncFileUpload(param) ⇒ Promise.<FileUploadResult>
上传文件
Kind: static method of sysManage
Returns: Promise.<FileUploadResult> - 文件上传结果
| Param | Type | Description |
|---|---|---|
| param | object |
参数 |
| param.group_d | number |
群组ID |
| param.toType | number |
接收者类型:rosterAvatar - 用户头像, chat - 聊天文件, groupAvatar - 群头像 |
| param.to_id | number |
接收者ID |
| param.file | File |
文件 |
| param.fileType | string |
文件类型:file - 普通聊天文件, audio - 语音聊天文件(amr格式),image - 图片聊天文件, video - 视频聊天文件, audio-mp3 - 语音聊天文件(mp3格式), shareFile - 普通共享文件, shareAudio - 语音共享文件, shareImage - 图片共享文件, shareVideo - 视频共享文件 |
| param.chatType | number |
聊天类型: roster - 单聊, group - 群聊 |
| param.processCallback | fileUploadProgress |
上传进度回调 |
sysManage.getImage(param) ⇒ string
拼装图片路径
Kind: static method of sysManage
Returns: string - 图片地址
| Param | Type | Description |
|---|---|---|
| param | object |
|
| param.avatar | string |
文件地址 |
| param.type | string |
类型: roster - 用户, group - 群 |
| param.thumbnail | boolean |
是否缩略图:默认为true |
| param.sdefault | string |
默认图片地址 |
sysManage.deleteConversation(id, other_devices)
删除会话
Kind: static method of sysManage
| Param | Type | Default | Description |
|---|---|---|---|
| id | number |
会话ID | |
| other_devices | boolean |
true |
是否同时删除其它设备上的会话 |
sysManage.asyncGetGroupAvatarUploadUrl(params) ⇒ Promise.<FileUpload>
获取上传群头像URL
Kind: static method of sysManage
Returns: Promise.<FileUpload> - 文件上传信息
| Param | Type | Description |
|---|---|---|
| params | object |
参数 |
| params.group_id | number |
群组ID |
sysManage.asyncGetFileUploadChatFileUrl(params) ⇒ Promise.<FileUpload>
获取聊天文件上传地址
Kind: static method of sysManage
Returns: Promise.<FileUpload> - 文件上传信息
| Param | Type | Description |
|---|---|---|
| params | object |
参数 |
| params.file_type | number |
文件类型: 100 - 普通聊天文件, 101 - 语音聊天文件(amr格式),102 - 图片聊天文件, 103 - 视频聊天文件, 104 - 语音聊天文件(mp3格式)200 - 普通共享文件, 201 - 语音共享文件, 202 - 图片共享文件, 203 - 视频共享文件 |
| params.to_type | number |
会话类型: 1 - 用户,2 - 群组 |
| params.to_id | number |
会话ID |