123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- package me.chanjar.weixin.enterprise.bean;
- import java.util.ArrayList;
- import java.util.List;
- import me.chanjar.weixin.enterprise.api.WxConsts;
- import me.chanjar.weixin.enterprise.bean.custombuilder.ImageBuilder;
- import me.chanjar.weixin.enterprise.bean.custombuilder.MusicBuilder;
- import me.chanjar.weixin.enterprise.bean.custombuilder.NewsBuilder;
- import me.chanjar.weixin.enterprise.bean.custombuilder.TextBuilder;
- import me.chanjar.weixin.enterprise.bean.custombuilder.VideoBuilder;
- import me.chanjar.weixin.enterprise.bean.custombuilder.VoiceBuilder;
- import me.chanjar.weixin.enterprise.util.json.WxGsonBuilder;
- /**
- * 客服消息
- * @author Daniel Qian
- *
- */
- public class WxCustomMessage {
- private String toUser;
- private String msgType;
- private String content;
- private String mediaId;
- private String thumbMediaId;
- private String title;
- private String description;
- private String musicUrl;
- private String hqMusicUrl;
- private List<WxArticle> articles = new ArrayList<WxArticle>();
-
- public String getToUser() {
- return toUser;
- }
- public void setToUser(String toUser) {
- this.toUser = toUser;
- }
- public String getMsgType() {
- return msgType;
- }
-
- /**
- * <pre>
- * 请使用
- * {@link WxConsts#CUSTOM_MSG_TEXT}
- * {@link WxConsts#CUSTOM_MSG_IMAGE}
- * {@link WxConsts#CUSTOM_MSG_VOICE}
- * {@link WxConsts#CUSTOM_MSG_MUSIC}
- * {@link WxConsts#CUSTOM_MSG_VIDEO}
- * {@link WxConsts#CUSTOM_MSG_NEWS}
- * </pre>
- * @param msgType
- */
- public void setMsgType(String msgType) {
- this.msgType = msgType;
- }
- public String getContent() {
- return content;
- }
- public void setContent(String content) {
- this.content = content;
- }
- public String getMediaId() {
- return mediaId;
- }
- public void setMediaId(String mediaId) {
- this.mediaId = mediaId;
- }
- public String getThumbMediaId() {
- return thumbMediaId;
- }
- public void setThumbMediaId(String thumbMediaId) {
- this.thumbMediaId = thumbMediaId;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getMusicUrl() {
- return musicUrl;
- }
- public void setMusicUrl(String musicUrl) {
- this.musicUrl = musicUrl;
- }
- public String getHqMusicUrl() {
- return hqMusicUrl;
- }
- public void setHqMusicUrl(String hqMusicUrl) {
- this.hqMusicUrl = hqMusicUrl;
- }
- public List<WxArticle> getArticles() {
- return articles;
- }
- public void setArticles(List<WxArticle> articles) {
- this.articles = articles;
- }
-
- public String toJson() {
- return WxGsonBuilder.INSTANCE.create().toJson(this);
- }
-
- public static class WxArticle {
-
- private String title;
- private String description;
- private String url;
- private String picUrl;
-
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getUrl() {
- return url;
- }
- public void setUrl(String url) {
- this.url = url;
- }
- public String getPicUrl() {
- return picUrl;
- }
- public void setPicUrl(String picUrl) {
- this.picUrl = picUrl;
- }
-
- }
-
- /**
- * 获得文本消息builder
- * @return
- */
- public static TextBuilder TEXT() {
- return new TextBuilder();
- }
- /**
- * 获得图片消息builder
- * @return
- */
- public static ImageBuilder IMAGE() {
- return new ImageBuilder();
- }
- /**
- * 获得语音消息builder
- * @return
- */
- public static VoiceBuilder VOICE() {
- return new VoiceBuilder();
- }
-
- /**
- * 获得视频消息builder
- * @return
- */
- public static VideoBuilder VIDEO() {
- return new VideoBuilder();
- }
-
- /**
- * 获得音乐消息builder
- * @return
- */
- public static MusicBuilder MUSIC() {
- return new MusicBuilder();
- }
-
- /**
- * 获得图文消息builder
- * @return
- */
- public static NewsBuilder NEWS() {
- return new NewsBuilder();
- }
-
- }
|