mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
实现永久素材相关接口
This commit is contained in:
@@ -8,25 +8,29 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 群发时用到的图文消息素材
|
||||
* @author chanjarster
|
||||
*
|
||||
* @author chanjarster
|
||||
*/
|
||||
public class WxMpMassNews implements Serializable {
|
||||
|
||||
private List<WxMpMassNewsArticle> articles = new ArrayList<WxMpMassNewsArticle>();
|
||||
|
||||
|
||||
public List<WxMpMassNewsArticle> getArticles() {
|
||||
return articles;
|
||||
}
|
||||
|
||||
|
||||
public void addArticle(WxMpMassNewsArticle article) {
|
||||
this.articles.add(article);
|
||||
}
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
|
||||
public boolean isEmpty() {
|
||||
return articles == null || articles.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 群发图文消息article
|
||||
@@ -38,8 +42,8 @@ public class WxMpMassNews implements Serializable {
|
||||
* 6. digest 图文消息的描述
|
||||
* 7, showCoverPic 是否显示封面,true为显示,false为不显示
|
||||
* </pre>
|
||||
* @author chanjarster
|
||||
*
|
||||
* @author chanjarster
|
||||
*/
|
||||
public static class WxMpMassNewsArticle {
|
||||
/**
|
||||
@@ -70,49 +74,73 @@ public class WxMpMassNews implements Serializable {
|
||||
* 是否显示封面,true为显示,false为不显示
|
||||
*/
|
||||
private boolean showCoverPic;
|
||||
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return thumbMediaId;
|
||||
}
|
||||
|
||||
public void setThumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContentSourceUrl() {
|
||||
return contentSourceUrl;
|
||||
}
|
||||
|
||||
public void setContentSourceUrl(String contentSourceUrl) {
|
||||
this.contentSourceUrl = contentSourceUrl;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
public boolean isShowCoverPic() {
|
||||
return showCoverPic;
|
||||
}
|
||||
|
||||
public void setShowCoverPic(boolean showCoverPic) {
|
||||
this.showCoverPic = showCoverPic;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
|
||||
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
|
||||
", showCoverPic=" + showCoverPic + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMassNews [" + "articles=" + articles + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WxMpMaterial {
|
||||
|
||||
private String name;
|
||||
private File file;
|
||||
private String videoTitle;
|
||||
private String videoIntroduction;
|
||||
|
||||
public WxMpMaterial() {
|
||||
}
|
||||
|
||||
public WxMpMaterial(String name, File file, String videoTitle, String videoIntroduction) {
|
||||
this.name = name;
|
||||
this.file = file;
|
||||
this.videoTitle = videoTitle;
|
||||
this.videoIntroduction = videoIntroduction;
|
||||
}
|
||||
|
||||
public Map<String, String> getForm() {
|
||||
Map<String, String> form = new HashMap<String, String>();
|
||||
form.put("title", videoTitle);
|
||||
form.put("introduction", videoIntroduction);
|
||||
return form;
|
||||
}
|
||||
|
||||
public String getVideoTitle() {
|
||||
return videoTitle;
|
||||
}
|
||||
|
||||
public void setVideoTitle(String videoTitle) {
|
||||
this.videoTitle = videoTitle;
|
||||
}
|
||||
|
||||
public String getVideoIntroduction() {
|
||||
return videoIntroduction;
|
||||
}
|
||||
|
||||
public void setVideoIntroduction(String videoIntroduction) {
|
||||
this.videoIntroduction = videoIntroduction;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterial [" + "name=" + name + ", file=" + file + ", videoTitle=" + videoTitle + ", videoIntroduction=" + videoIntroduction + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxMpMaterialArticleUpdate implements Serializable {
|
||||
|
||||
private String mediaId;
|
||||
private int index;
|
||||
private WxMpMaterialNews.WxMpMaterialNewsArticle articles;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public WxMpMaterialNews.WxMpMaterialNewsArticle getArticles() {
|
||||
return articles;
|
||||
}
|
||||
|
||||
public void setArticles(WxMpMaterialNews.WxMpMaterialNewsArticle articles) {
|
||||
this.articles = articles;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialArticleUpdate [" + "mediaId=" + mediaId + ", index=" + index + ", articles=" + articles + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WxMpMaterialNews implements Serializable {
|
||||
|
||||
private List<WxMpMaterialNewsArticle> articles = new ArrayList<WxMpMaterialNewsArticle>();
|
||||
|
||||
public List<WxMpMaterialNewsArticle> getArticles() {
|
||||
return articles;
|
||||
}
|
||||
|
||||
public void addArticle(WxMpMaterialNewsArticle article) {
|
||||
this.articles.add(article);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return articles == null || articles.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 群发图文消息article
|
||||
* 1. thumbMediaId (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
|
||||
* 2. author 图文消息的作者
|
||||
* 3. title (必填) 图文消息的标题
|
||||
* 4. contentSourceUrl 在图文消息页面点击“阅读原文”后的页面链接
|
||||
* 5. content (必填) 图文消息页面的内容,支持HTML标签
|
||||
* 6. digest 图文消息的描述
|
||||
* 7, showCoverPic 是否显示封面,true为显示,false为不显示
|
||||
* </pre>
|
||||
*
|
||||
* @author chanjarster
|
||||
*/
|
||||
public static class WxMpMaterialNewsArticle {
|
||||
/**
|
||||
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
|
||||
*/
|
||||
private String thumbMediaId;
|
||||
/**
|
||||
* 图文消息的作者
|
||||
*/
|
||||
private String author;
|
||||
/**
|
||||
* (必填) 图文消息的标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 在图文消息页面点击“阅读原文”后的页面链接
|
||||
*/
|
||||
private String contentSourceUrl;
|
||||
/**
|
||||
* (必填) 图文消息页面的内容,支持HTML标签
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 图文消息的描述
|
||||
*/
|
||||
private String digest;
|
||||
/**
|
||||
* 是否显示封面,true为显示,false为不显示
|
||||
*/
|
||||
private boolean showCoverPic;
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return thumbMediaId;
|
||||
}
|
||||
|
||||
public void setThumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContentSourceUrl() {
|
||||
return contentSourceUrl;
|
||||
}
|
||||
|
||||
public void setContentSourceUrl(String contentSourceUrl) {
|
||||
this.contentSourceUrl = contentSourceUrl;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
public boolean isShowCoverPic() {
|
||||
return showCoverPic;
|
||||
}
|
||||
|
||||
public void setShowCoverPic(boolean showCoverPic) {
|
||||
this.showCoverPic = showCoverPic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
|
||||
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
|
||||
", showCoverPic=" + showCoverPic + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialNews [" + "articles=" + articles + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxMpMaterialCountResult implements Serializable {
|
||||
|
||||
private int voiceCount;
|
||||
private int videoCount;
|
||||
private int imageCount;
|
||||
private int newsCount;
|
||||
|
||||
public int getVoiceCount() {
|
||||
return voiceCount;
|
||||
}
|
||||
|
||||
public void setVoiceCount(int voiceCount) {
|
||||
this.voiceCount = voiceCount;
|
||||
}
|
||||
|
||||
public int getVideoCount() {
|
||||
return videoCount;
|
||||
}
|
||||
|
||||
public void setVideoCount(int videoCount) {
|
||||
this.videoCount = videoCount;
|
||||
}
|
||||
|
||||
public int getImageCount() {
|
||||
return imageCount;
|
||||
}
|
||||
|
||||
public void setImageCount(int imageCount) {
|
||||
this.imageCount = imageCount;
|
||||
}
|
||||
|
||||
public int getNewsCount() {
|
||||
return newsCount;
|
||||
}
|
||||
|
||||
public void setNewsCount(int newsCount) {
|
||||
this.newsCount = newsCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialCountResult [" + "voiceCount=" + voiceCount + ", videoCount=" + videoCount
|
||||
+ ", imageCount=" + imageCount + ", newsCount=" + newsCount + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class WxMpMaterialFileBatchGetResult implements Serializable {
|
||||
|
||||
private int totalCount;
|
||||
private int itemCount;
|
||||
private List<WxMaterialFileBatchGetNewsItem> items;
|
||||
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
|
||||
public List<WxMaterialFileBatchGetNewsItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<WxMaterialFileBatchGetNewsItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialFileBatchGetResult [" + "totalCount=" + totalCount + ", itemCount=" + itemCount + ", items=" + items + "]";
|
||||
}
|
||||
|
||||
public static class WxMaterialFileBatchGetNewsItem {
|
||||
private String mediaId;
|
||||
private Date updateTime;
|
||||
private String name;
|
||||
private String url;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMaterialFileBatchGetNewsItem [" + "mediaId=" + mediaId + ", updateTime=" + updateTime + ", name=" + name + ", url=" + url + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterialNews;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class WxMpMaterialNewsBatchGetResult implements Serializable {
|
||||
|
||||
private int totalCount;
|
||||
private int itemCount;
|
||||
private List<WxMaterialNewsBatchGetNewsItem> items;
|
||||
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
|
||||
public List<WxMaterialNewsBatchGetNewsItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<WxMaterialNewsBatchGetNewsItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialNewsBatchGetResult [" + "totalCount=" + totalCount + ", itemCount=" + itemCount + ", items=" + items + "]";
|
||||
}
|
||||
|
||||
public static class WxMaterialNewsBatchGetNewsItem {
|
||||
private String mediaId;
|
||||
private Date updateTime;
|
||||
private WxMpMaterialNews content;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public WxMpMaterialNews getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(WxMpMaterialNews content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMaterialNewsBatchGetNewsItem [" + "mediaId=" + mediaId + ", updateTime=" + updateTime + ", content=" + content + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxMpMaterialUploadResult implements Serializable {
|
||||
|
||||
private String mediaId;
|
||||
private String url;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public static WxMpMaterialUploadResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialUploadResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialUploadResult [media_id=" + mediaId + ", url=" + url + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxMpMaterialVideoInfoResult implements Serializable {
|
||||
|
||||
private String title;
|
||||
private String description;
|
||||
private String downUrl;
|
||||
|
||||
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 getDownUrl() {
|
||||
return downUrl;
|
||||
}
|
||||
|
||||
public void setDownUrl(String downUrl) {
|
||||
this.downUrl = downUrl;
|
||||
}
|
||||
|
||||
public static WxMpMaterialVideoInfoResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialVideoInfoResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpMaterialVideoInfoResult [title=" + title + ", description=" + description + ", downUrl=" + downUrl + "]";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user