sysManage#
sysManage#
- sysManage
- .sendRosterMessage(msg) ⇒
number - .sendGroupMessage(msg) ⇒
number - .requireHistoryMessage(uid, sid, amount)
- .sendMentionMessage(params) ⇒
number - .sendInputStatusMessage(uid, status) ⇒
number - .forwardMessage(param) ⇒
number - .getMessageStatus(cid, mid, isGroup) ⇒
string - .asyncFileUpload(param) ⇒
Promise.<FileUploadResult> - .getImage(param) ⇒
string - .deleteConversation(id, other_devices)
- .asyncGetGroupAvatarUploadUrl(params) ⇒
Promise.<FileUpload> - .asyncGetFileUploadChatFileUrl(params) ⇒
Promise.<FileUpload>
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 | 附件信息 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="sendRosterMessage" %}{% endlanying_code_snippet %}
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表示擴散,數字越小擴散的越多。 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="sendGroupMessage" %}{% endlanying_code_snippet %}
sysManage.requireHistoryMessage(uid, sid, amount)#
請求歷史訊息
Kind: static method of sysManage
| Param | Type | Description |
|---|---|---|
| uid | number | 會話ID |
| sid | number | 訊息ID: 從哪個訊息向前拉取,傳0表示從最新一條訊息開始拉取。 |
| amount | number | 拉取的條數 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="requireHistoryMessage" %}{% endlanying_code_snippet %}
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 | 發送者暱稱 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="sendMentionMessage" %}{% endlanying_code_snippet %}
sysManage.sendInputStatusMessage(uid, status) ⇒ number#
發送輸入狀態訊息
Kind: static method of sysManage
Returns: number - 客戶端生成的訊息ID
| Param | Type | Description |
|---|---|---|
| uid | number | 會話ID |
| status | string | 狀態: nothing - 未輸入, typing - 正在輸入 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="sendInputStatusMessage" %}{% endlanying_code_snippet %}
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 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="forwardMessage" %}{% endlanying_code_snippet %}
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 | 是否是群聊 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="getMessageStatus" %}{% endlanying_code_snippet %}
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 | 上傳進度回呼 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="asyncFileUpload" %}{% endlanying_code_snippet %}
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 | 預設圖片地址 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="getImage" %}{% endlanying_code_snippet %}
sysManage.deleteConversation(id, other_devices)#
刪除會話
Kind: static method of sysManage
| Param | Type | Default | Description |
|---|---|---|---|
| id | number | 會話ID | |
| other_devices | boolean | true | 是否同時刪除其它設備上的會話 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="sysManage",function="deleteConversation" %}{% endlanying_code_snippet %}
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 |