View Javadoc
1   package com.foxinmy.weixin4j.tuple;
2   
3   import java.io.Serializable;
4   
5   import com.alibaba.fastjson.annotation.JSONField;
6   
7   /**
8    * 群发消息图文(消息内容存储在微信后台)
9    *
10   * @className MpArticle
11   * @author jinyu(foxinmy@gmail.com)
12   * @date 2014年4月26日
13   * @since JDK 1.6
14   */
15  public class MpArticle implements Serializable {
16  
17      private static final long serialVersionUID = 5583479943661639234L;
18  
19      /**
20       * 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 非空
21       */
22      @JSONField(name = "thumb_media_id")
23      private String thumbMediaId;
24      /**
25       * 图文消息的封面图片的地址(不一定有,请关注thumbMediaId)
26       */
27      @JSONField(name = "thumb_url")
28      private String thumbUrl;
29      /**
30       * 图文消息的作者 可为空
31       */
32      private String author;
33      /**
34       * 图文消息的标题 非空
35       */
36      private String title;
37      /**
38       * 图文页的URL 获取图文消息时,群发消息时填写无效。
39       */
40      private String url;
41      /**
42       * 在图文消息页面点击“阅读原文”后的页面 可为空
43       */
44      @JSONField(name = "content_source_url")
45      private String sourceUrl;
46      /**
47       * 图文消息页面的内容,支持HTML标签 非空
48       */
49      private String content;
50      /**
51       * 图文消息的描述 可为空
52       */
53      private String digest;
54      /**
55       * 是否显示封面,1为显示,0为不显示 可为空
56       */
57      @JSONField(name = "show_cover_pic")
58      private String showCoverPic;
59      /**
60       * 是否打开评论,0不打开,1打开
61       */
62      @JSONField(name = "need_open_comment")
63      private String openComment;
64      /**
65       * 是否粉丝才可评论,0所有人可评论,1粉丝才可评论
66       */
67      @JSONField(name = "only_fans_can_comment")
68      private String onlyFansCanComment;
69  
70      protected MpArticle() {
71      }
72  
73      /**
74       * @param thumbMediaId
75       *            缩略图
76       * @param title
77       *            标题
78       * @param content
79       *            内容
80       */
81      public MpArticle(String thumbMediaId, String title, String content) {
82          this.thumbMediaId = thumbMediaId;
83          this.title = title;
84          this.content = content;
85      }
86  
87      public String getThumbMediaId() {
88          return thumbMediaId;
89      }
90  
91      public void setThumbMediaId(String thumbMediaId) {
92          this.thumbMediaId = thumbMediaId;
93      }
94  
95      public String getThumbUrl() {
96          return thumbUrl;
97      }
98  
99      public void setThumbUrl(String thumbUrl) {
100         this.thumbUrl = thumbUrl;
101     }
102 
103     public String getAuthor() {
104         return author;
105     }
106 
107     public void setAuthor(String author) {
108         this.author = author;
109     }
110 
111     public String getTitle() {
112         return title;
113     }
114 
115     public void setTitle(String title) {
116         this.title = title;
117     }
118 
119     public String getUrl() {
120         return url;
121     }
122 
123     public void setUrl(String url) {
124         this.url = url;
125     }
126 
127     public String getSourceUrl() {
128         return sourceUrl;
129     }
130 
131     public void setSourceUrl(String sourceUrl) {
132         this.sourceUrl = sourceUrl;
133     }
134 
135     public String getContent() {
136         return content;
137     }
138 
139     public void setContent(String content) {
140         this.content = content;
141     }
142 
143     public String getDigest() {
144         return digest;
145     }
146 
147     public void setDigest(String digest) {
148         this.digest = digest;
149     }
150 
151     public String getShowCoverPic() {
152         return showCoverPic;
153     }
154 
155     public void setShowCoverPic(String showCoverPic) {
156         this.showCoverPic = showCoverPic;
157     }
158 
159     public void setShowCoverPic(boolean showCoverPic) {
160         this.showCoverPic = showCoverPic ? "1" : "0";
161     }
162 
163     @JSONField(serialize = false)
164     public boolean getFormatShowCoverPic() {
165         return this.showCoverPic != null && this.showCoverPic.equals("1");
166     }
167 
168     public void setOpenComment(boolean openComment) {
169         this.openComment = openComment ? "1" : "0";
170     }
171 
172     public String getOpenComment() {
173         return openComment;
174     }
175 
176     public void setOpenComment(String openComment) {
177         this.openComment = openComment;
178     }
179 
180     public String getOnlyFansCanComment() {
181         return onlyFansCanComment;
182     }
183 
184     public void setOnlyFansCanComment(String onlyFansCanComment) {
185         this.onlyFansCanComment = onlyFansCanComment;
186     }
187 
188     @JSONField(serialize = false)
189     public boolean getFormatOpenComment() {
190         return this.openComment != null && this.openComment.equals("1");
191     }
192 
193     public void setOnlyFansCanComment(boolean onlyFansCanComment) {
194         this.onlyFansCanComment = onlyFansCanComment ? "1" : "0";
195     }
196 
197     @JSONField(serialize = false)
198     public boolean getFormatOnlyFansCanComment() {
199         return this.onlyFansCanComment != null && this.onlyFansCanComment.equals("1");
200     }
201 
202     @Override
203     public String toString() {
204         return "MpArticle [thumbMediaId=" + thumbMediaId + ", thumbUrl=" + thumbUrl + ", author=" + author + ", title="
205                 + title + ", url=" + url + ", sourceUrl=" + sourceUrl + ", content=" + content + ", digest=" + digest
206                 + ", showCoverPic=" + showCoverPic + ", openComment=" + openComment + ", onlyFansCanComment="
207                 + onlyFansCanComment + "]";
208     }
209 }