🎨 #2541 【企业微信】发送群聊机器人消息接口增加对文件类型的支持

This commit is contained in:
zhongjun
2022-05-17 13:52:15 +08:00
committed by GitHub
parent 19c311391e
commit 5da9fb30aa
4 changed files with 35 additions and 5 deletions

View File

@@ -57,6 +57,11 @@ public class WxCpGroupRobotMessage implements Serializable {
*/
private List<NewArticle> articles;
/**
* 文件id
*/
private String mediaId;
public String toJson() {
JsonObject messageJson = new JsonObject();
messageJson.addProperty("msgtype", this.getMsgType());
@@ -112,6 +117,12 @@ public class WxCpGroupRobotMessage implements Serializable {
messageJson.add("news", text);
break;
}
case FILE: {
JsonObject file = new JsonObject();
file.addProperty("media_id", this.getMediaId());
messageJson.add("file", file);
break;
}
default:
}