Skip to content

Commit 184e6d7

Browse files
committed
WxMenuButton增加缺失的media_id字段
1 parent 977161c commit 184e6d7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/menu/WxMenuButton.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ public class WxMenuButton {
1212
private String name;
1313
private String key;
1414
private String url;
15+
private String mediaId;
1516

1617
private List<WxMenuButton> subButtons = new ArrayList<WxMenuButton>();
1718

19+
@Override
20+
public String toString() {
21+
return ToStringBuilder.reflectionToString(this,
22+
ToStringStyle.JSON_STYLE);
23+
}
24+
1825
public String getType() {
1926
return type;
2027
}
@@ -55,8 +62,11 @@ public void setSubButtons(List<WxMenuButton> subButtons) {
5562
this.subButtons = subButtons;
5663
}
5764

58-
@Override
59-
public String toString() {
60-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
65+
public String getMediaId() {
66+
return mediaId;
67+
}
68+
69+
public void setMediaId(String mediaId) {
70+
this.mediaId = mediaId;
6171
}
6272
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/json/WxMenuGsonAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ protected JsonObject convertToJson(WxMenuButton button) {
5252
buttonJson.addProperty("name", button.getName());
5353
buttonJson.addProperty("key", button.getKey());
5454
buttonJson.addProperty("url", button.getUrl());
55+
buttonJson.addProperty("media_id", button.getMediaId());
5556
if (button.getSubButtons() != null && button.getSubButtons().size() > 0) {
5657
JsonArray buttonArray = new JsonArray();
5758
for (WxMenuButton sub_button : button.getSubButtons()) {
@@ -105,6 +106,7 @@ protected WxMenuButton convertFromJson(JsonObject json) {
105106
button.setKey(GsonHelper.getString(json, "key"));
106107
button.setUrl(GsonHelper.getString(json, "url"));
107108
button.setType(GsonHelper.getString(json, "type"));
109+
button.setMediaId(GsonHelper.getString(json, "media_id"));
108110
return button;
109111
}
110112

0 commit comments

Comments
 (0)