diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/ArticleComment.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/ArticleComment.java index 8450832b..838b8612 100644 --- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/ArticleComment.java +++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/ArticleComment.java @@ -1,6 +1,6 @@ package com.foxinmy.weixin4j.mp.model; -import java.io.Serializable; +import com.alibaba.fastjson.annotation.JSONField; /** * 文章评论 @@ -11,12 +11,61 @@ import java.io.Serializable; * @since JDK 1.6 * @see */ -public class ArticleComment implements Serializable { +public class ArticleComment extends Comment { - private static final long serialVersionUID = -8506024679132313314L; + private static final long serialVersionUID = -8506024679132313314L; + @JSONField(name = "user_comment_id") + private String id;// 用户评论id + private String openid;// openid + @JSONField(name = "comment_type") + private int type;// 是否精选评论,0为即非精选,1为true,即精选 + private Comment reply; // 评论回复 - public enum ArticleCommentType { - GENERAL, // 普通评论 - MARKELECT // 精选评论 - } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public int getType() { + return type; + } + + @JSONField(serialize = false) + public ArticleCommentType getFormatType() { + if (type == 0) { + return ArticleCommentType.GENERAL; + } else if (type == 1) { + return ArticleCommentType.MARKELECT; + } else { + return null; + } + } + + public void setType(int type) { + this.type = type; + } + + public Comment getReply() { + return reply; + } + + public void setReply(Comment reply) { + this.reply = reply; + } + + public enum ArticleCommentType { + GENERAL, // 普通评论 + MARKELECT // 精选评论 + } } diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/Comment.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/Comment.java new file mode 100644 index 00000000..fd85c70f --- /dev/null +++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/model/Comment.java @@ -0,0 +1,47 @@ +package com.foxinmy.weixin4j.mp.model; + +import java.io.Serializable; +import java.util.Date; + +import com.alibaba.fastjson.annotation.JSONField; + +/** + * + * @className Comment + * @author jinyu(foxinmy@gmail.com) + * @date 2017年5月19日 + * @since JDK 1.6 + * @see + */ +public class Comment implements Serializable { + private static final long serialVersionUID = 1L; + private String content;// 评论内容 + @JSONField(name = "create_time") + private long createTime;// 评论时间 + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public long getCreateTime() { + return createTime; + } + + @JSONField(serialize = false) + public Date getFormatCreateTime() { + return new Date(createTime * 1000l); + } + + public void setCreateTime(long createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + return "content=" + content + ", createTime=" + createTime; + } +} \ No newline at end of file