mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	增加了获取图文素材中文章的封面图url
This commit is contained in:
		| @ -46,6 +46,10 @@ public class WxMpMaterialNews implements Serializable { | ||||
|      * (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 | ||||
|      */ | ||||
|     private String thumbMediaId; | ||||
|     /** | ||||
|      * 图文消息的封面url | ||||
|      */ | ||||
|     private String thumbUrl; | ||||
|     /** | ||||
|      * 图文消息的作者 | ||||
|      */ | ||||
| @ -141,9 +145,17 @@ public class WxMpMaterialNews implements Serializable { | ||||
|         this.url = url; | ||||
|     } | ||||
|  | ||||
|     public String getThumbUrl() { | ||||
|       return thumbUrl; | ||||
|     } | ||||
|  | ||||
|     public void setThumbUrl(String thumbUrl) { | ||||
|       this.thumbUrl = thumbUrl; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|       return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title + | ||||
|       return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + "thumbUrl=" + thumbUrl + ", author=" + author + ", title=" + title + | ||||
|           ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + | ||||
|           ", showCoverPic=" + showCoverPic +", url=" + url + "]"; | ||||
|     } | ||||
|  | ||||
| @ -20,6 +20,7 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa | ||||
|     JsonObject articleJson = new JsonObject(); | ||||
|  | ||||
|     articleJson.addProperty("thumb_media_id", article.getThumbMediaId()); | ||||
|     articleJson.addProperty("thumb_url",article.getThumbUrl()); | ||||
|     articleJson.addProperty("title", article.getTitle()); | ||||
|     articleJson.addProperty("content", article.getContent()); | ||||
|     if (null != article.getAuthor()) { | ||||
| @ -66,6 +67,10 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa | ||||
|     if (thumbMediaId != null && !thumbMediaId.isJsonNull()) { | ||||
|       article.setThumbMediaId(GsonHelper.getAsString(thumbMediaId)); | ||||
|     } | ||||
|     JsonElement thumbUrl = articleInfo.get("thumb_url"); | ||||
|     if(thumbUrl != null && !thumbUrl.isJsonNull()) { | ||||
|       article.setThumbUrl(GsonHelper.getAsString(thumbUrl)); | ||||
|     } | ||||
|     JsonElement showCoverPic = articleInfo.get("show_cover_pic"); | ||||
|     if (showCoverPic != null && !showCoverPic.isJsonNull()) { | ||||
|       article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic)); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 miller
					miller