文章评论

This commit is contained in:
jinyu 2017-05-19 21:16:12 +08:00
parent c53e0718ef
commit fe1bbf8b43
2 changed files with 103 additions and 7 deletions

View File

@ -1,6 +1,6 @@
package com.foxinmy.weixin4j.mp.model; 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 * @since JDK 1.6
* @see * @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 { public String getId() {
GENERAL, // 普通评论 return id;
MARKELECT // 精选评论 }
}
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 // 精选评论
}
} }

View File

@ -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;
}
}