From 534b24dfa49f34b711634afcb9e8e685fa6acc32 Mon Sep 17 00:00:00 2001 From: Libin YANG Date: Mon, 25 Nov 2024 19:18:31 +0800 Subject: [PATCH] fix: msgbody type (#191) close #190 --- README.md | 2 +- README_CN.md | 2 +- docs/guide/README.md | 2 +- docs/guide/quickstart.md | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- pom.xml | 2 +- .../github/doocs/im/model/response/RspMsgItem.java | 14 +++++++++++--- src/main/resources/version.properties | 2 +- 9 files changed, 21 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 51f0717..21eaa08 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ If you're using Maven, just add the following dependency in `pom.xml`. io.github.doocs im-server-sdk-java - 0.4.08 + 0.4.09 ``` diff --git a/README_CN.md b/README_CN.md index 068378c..b023a3c 100644 --- a/README_CN.md +++ b/README_CN.md @@ -25,7 +25,7 @@ https://doocs.github.io/qcloud-im-server-sdk-java io.github.doocs im-server-sdk-java - 0.4.08 + 0.4.09 ``` diff --git a/docs/guide/README.md b/docs/guide/README.md index 9bb414b..7eb2ab6 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,6 +1,6 @@ # 介绍 -本文档基于腾讯云 IM Server SDK Java 编写。 +本文档基于腾讯云 IM Server SDK Java 编写。 ## 前提条件 diff --git a/docs/guide/quickstart.md b/docs/guide/quickstart.md index ab1dac4..3b2aa9d 100644 --- a/docs/guide/quickstart.md +++ b/docs/guide/quickstart.md @@ -10,14 +10,14 @@ io.github.doocs im-server-sdk-java - 0.4.08 + 0.4.09 ``` ### Gradle ```gradle -implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.4.08' +implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.4.09' ``` ### 下载 JAR diff --git a/package-lock.json b/package-lock.json index 6c114a4..3b5d340 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "qcloud-im-server-sdk-java", - "version": "0.4.08", + "version": "0.4.09", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "qcloud-im-server-sdk-java", - "version": "0.4.08", + "version": "0.4.09", "license": "Apache-2.0", "devDependencies": { "@vuepress/bundler-vite": "^2.0.0-rc.18", diff --git a/package.json b/package.json index 480663e..0ed680b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qcloud-im-server-sdk-java", - "version": "0.4.08", + "version": "0.4.09", "description": "腾讯云 IM 服务端 SDK API 文档 Java 版", "main": "index.js", "scripts": { diff --git a/pom.xml b/pom.xml index ee97d04..8aefb54 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.doocs im-server-sdk-java - 0.4.08 + 0.4.09 jar qcloud-im-server-sdk-java diff --git a/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java b/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java index 1fa1d4a..5d062e7 100644 --- a/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java +++ b/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java @@ -4,6 +4,7 @@ import io.github.doocs.im.model.message.TIMMsgElement; import java.io.Serializable; +import java.util.Collections; import java.util.List; /** @@ -28,7 +29,7 @@ public class RspMsgItem implements Serializable { * 消息内容,详情请参见 消息内容 MsgBody 说明 */ @JsonProperty("MsgBody") - private List msgBody; + private Object msgBody; /** * 字段为 1 时表示系统消息 @@ -83,11 +84,18 @@ public void setIsPlaceMsg(Integer isPlaceMsg) { this.isPlaceMsg = isPlaceMsg; } + @SuppressWarnings("unchecked") public List getMsgBody() { - return msgBody; + if (msgBody instanceof List) { + return (List) msgBody; + } + if (msgBody instanceof TIMMsgElement) { + return Collections.singletonList((TIMMsgElement) msgBody); + } + return Collections.emptyList(); } - public void setMsgBody(List msgBody) { + public void setMsgBody(Object msgBody) { this.msgBody = msgBody; } diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties index 5452705..50de117 100644 --- a/src/main/resources/version.properties +++ b/src/main/resources/version.properties @@ -1 +1 @@ -version=0.4.08 +version=0.4.09