mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 #2541 【企业微信】发送群聊机器人消息接口增加对文件类型的支持
This commit is contained in:
@@ -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:
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user