|
| 1 | +package me.chanjar.weixin.mp.bean; |
| 2 | + |
| 3 | +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; |
| 4 | + |
| 5 | +import java.io.Serializable; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.List; |
| 8 | + |
| 9 | +public class WxMpMaterialNews implements Serializable { |
| 10 | + |
| 11 | + private List<WxMpMaterialNewsArticle> articles = new ArrayList<WxMpMaterialNewsArticle>(); |
| 12 | + |
| 13 | + public List<WxMpMaterialNewsArticle> getArticles() { |
| 14 | + return articles; |
| 15 | + } |
| 16 | + |
| 17 | + public void addArticle(WxMpMaterialNewsArticle article) { |
| 18 | + this.articles.add(article); |
| 19 | + } |
| 20 | + |
| 21 | + public String toJson() { |
| 22 | + return WxMpGsonBuilder.INSTANCE.create().toJson(this); |
| 23 | + } |
| 24 | + |
| 25 | + public boolean isEmpty() { |
| 26 | + return articles == null || articles.isEmpty(); |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * <pre> |
| 31 | + * 群发图文消息article |
| 32 | + * 1. thumbMediaId (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 |
| 33 | + * 2. author 图文消息的作者 |
| 34 | + * 3. title (必填) 图文消息的标题 |
| 35 | + * 4. contentSourceUrl 在图文消息页面点击“阅读原文”后的页面链接 |
| 36 | + * 5. content (必填) 图文消息页面的内容,支持HTML标签 |
| 37 | + * 6. digest 图文消息的描述 |
| 38 | + * 7, showCoverPic 是否显示封面,true为显示,false为不显示 |
| 39 | + * </pre> |
| 40 | + * |
| 41 | + * @author chanjarster |
| 42 | + */ |
| 43 | + public static class WxMpMaterialNewsArticle { |
| 44 | + /** |
| 45 | + * (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 |
| 46 | + */ |
| 47 | + private String thumbMediaId; |
| 48 | + /** |
| 49 | + * 图文消息的作者 |
| 50 | + */ |
| 51 | + private String author; |
| 52 | + /** |
| 53 | + * (必填) 图文消息的标题 |
| 54 | + */ |
| 55 | + private String title; |
| 56 | + /** |
| 57 | + * 在图文消息页面点击“阅读原文”后的页面链接 |
| 58 | + */ |
| 59 | + private String contentSourceUrl; |
| 60 | + /** |
| 61 | + * (必填) 图文消息页面的内容,支持HTML标签 |
| 62 | + */ |
| 63 | + private String content; |
| 64 | + /** |
| 65 | + * 图文消息的描述 |
| 66 | + */ |
| 67 | + private String digest; |
| 68 | + /** |
| 69 | + * 是否显示封面,true为显示,false为不显示 |
| 70 | + */ |
| 71 | + private boolean showCoverPic; |
| 72 | + |
| 73 | + public String getThumbMediaId() { |
| 74 | + return thumbMediaId; |
| 75 | + } |
| 76 | + |
| 77 | + public void setThumbMediaId(String thumbMediaId) { |
| 78 | + this.thumbMediaId = thumbMediaId; |
| 79 | + } |
| 80 | + |
| 81 | + public String getAuthor() { |
| 82 | + return author; |
| 83 | + } |
| 84 | + |
| 85 | + public void setAuthor(String author) { |
| 86 | + this.author = author; |
| 87 | + } |
| 88 | + |
| 89 | + public String getTitle() { |
| 90 | + return title; |
| 91 | + } |
| 92 | + |
| 93 | + public void setTitle(String title) { |
| 94 | + this.title = title; |
| 95 | + } |
| 96 | + |
| 97 | + public String getContentSourceUrl() { |
| 98 | + return contentSourceUrl; |
| 99 | + } |
| 100 | + |
| 101 | + public void setContentSourceUrl(String contentSourceUrl) { |
| 102 | + this.contentSourceUrl = contentSourceUrl; |
| 103 | + } |
| 104 | + |
| 105 | + public String getContent() { |
| 106 | + return content; |
| 107 | + } |
| 108 | + |
| 109 | + public void setContent(String content) { |
| 110 | + this.content = content; |
| 111 | + } |
| 112 | + |
| 113 | + public String getDigest() { |
| 114 | + return digest; |
| 115 | + } |
| 116 | + |
| 117 | + public void setDigest(String digest) { |
| 118 | + this.digest = digest; |
| 119 | + } |
| 120 | + |
| 121 | + public boolean isShowCoverPic() { |
| 122 | + return showCoverPic; |
| 123 | + } |
| 124 | + |
| 125 | + public void setShowCoverPic(boolean showCoverPic) { |
| 126 | + this.showCoverPic = showCoverPic; |
| 127 | + } |
| 128 | + |
| 129 | + @Override |
| 130 | + public String toString() { |
| 131 | + return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title + |
| 132 | + ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + |
| 133 | + ", showCoverPic=" + showCoverPic + "]"; |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + @Override |
| 138 | + public String toString() { |
| 139 | + return "WxMpMaterialNews [" + "articles=" + articles + "]"; |
| 140 | + } |
| 141 | +} |
0 commit comments