mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	WxMenuButton增加缺失的media_id字段
This commit is contained in:
		| @ -12,9 +12,16 @@ public class WxMenuButton { | |||||||
|   private String name; |   private String name; | ||||||
|   private String key; |   private String key; | ||||||
|   private String url; |   private String url; | ||||||
|  |   private String mediaId; | ||||||
|  |  | ||||||
|   private List<WxMenuButton> subButtons = new ArrayList<WxMenuButton>(); |   private List<WxMenuButton> subButtons = new ArrayList<WxMenuButton>(); | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public String toString() { | ||||||
|  |     return ToStringBuilder.reflectionToString(this,  | ||||||
|  |         ToStringStyle.JSON_STYLE); | ||||||
|  |   } | ||||||
|  |    | ||||||
|   public String getType() { |   public String getType() { | ||||||
|     return type; |     return type; | ||||||
|   } |   } | ||||||
| @ -55,8 +62,11 @@ public class WxMenuButton { | |||||||
|     this.subButtons = subButtons; |     this.subButtons = subButtons; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |   public String getMediaId() { | ||||||
|   public String toString() { |     return mediaId; | ||||||
|     return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); |   } | ||||||
|  |  | ||||||
|  |   public void setMediaId(String mediaId) { | ||||||
|  |     this.mediaId = mediaId; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -52,6 +52,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ | |||||||
|     buttonJson.addProperty("name", button.getName()); |     buttonJson.addProperty("name", button.getName()); | ||||||
|     buttonJson.addProperty("key", button.getKey()); |     buttonJson.addProperty("key", button.getKey()); | ||||||
|     buttonJson.addProperty("url", button.getUrl()); |     buttonJson.addProperty("url", button.getUrl()); | ||||||
|  |     buttonJson.addProperty("media_id", button.getMediaId()); | ||||||
|     if (button.getSubButtons() != null && button.getSubButtons().size() > 0) { |     if (button.getSubButtons() != null && button.getSubButtons().size() > 0) { | ||||||
|       JsonArray buttonArray = new JsonArray(); |       JsonArray buttonArray = new JsonArray(); | ||||||
|       for (WxMenuButton sub_button : button.getSubButtons()) { |       for (WxMenuButton sub_button : button.getSubButtons()) { | ||||||
| @ -105,6 +106,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ | |||||||
|     button.setKey(GsonHelper.getString(json, "key")); |     button.setKey(GsonHelper.getString(json, "key")); | ||||||
|     button.setUrl(GsonHelper.getString(json, "url")); |     button.setUrl(GsonHelper.getString(json, "url")); | ||||||
|     button.setType(GsonHelper.getString(json, "type")); |     button.setType(GsonHelper.getString(json, "type")); | ||||||
|  |     button.setMediaId(GsonHelper.getString(json, "media_id")); | ||||||
|     return button; |     return button; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 BinaryWang
					BinaryWang