这是文本消息的encode方法
- encode() {
- let payload = super.encode();
- payload.searchableContent = this.content;
- if (this.quoteInfo) {
- let obj = {
- "quote": this.quoteInfo.encode()
- }
-
- let orgStr = JSON.stringify(obj);
- let str = orgStr.replace(/"u":"([0-9]+)"/, "\"u\":$1");
-
- payload.binaryContent = wfc.utf8_to_b64(str);
- }
- return payload;
- }
-
这是所有消息功能的encode方法
-
- encode() {
- let payload = new MessagePayload();
- payload.type = this.type;
- payload.mentionedType = this.mentionedType;
- payload.mentionedTargets = this.mentionedTargets;
- payload.extra = this.extra;
- return payload;
- }
-