mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-19 14:46:25 +08:00
重构WxConsts类,对所有常量进行分类整理,便于阅读使用
This commit is contained in:
@@ -121,7 +121,7 @@ public class WxMpMaterialServiceImpl implements WxMpMaterialService {
|
||||
@Override
|
||||
public WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("type", WxConsts.MATERIAL_NEWS);
|
||||
params.put("type", WxConsts.MaterialType.NEWS);
|
||||
params.put("offset", offset);
|
||||
params.put("count", count);
|
||||
String responseText = this.wxMpService.post(MATERIAL_BATCHGET_URL, WxGsonBuilder.create().toJson(params));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -24,11 +25,11 @@ public class WxMpMassOpenIdsMessage implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 请使用
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
|
||||
* {@link WxConsts.MassMsgType#IMAGE}
|
||||
* {@link WxConsts.MassMsgType#MPNEWS}
|
||||
* {@link WxConsts.MassMsgType#TEXT}
|
||||
* {@link WxConsts.MassMsgType#MPVIDEO}
|
||||
* {@link WxConsts.MassMsgType#VOICE}
|
||||
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -18,11 +19,11 @@ public class WxMpMassPreviewMessage implements Serializable {
|
||||
* <pre>
|
||||
* 消息类型
|
||||
* 请使用
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
|
||||
* {@link WxConsts.MassMsgType#IMAGE}
|
||||
* {@link WxConsts.MassMsgType#MPNEWS}
|
||||
* {@link WxConsts.MassMsgType#TEXT}
|
||||
* {@link WxConsts.MassMsgType#MPVIDEO}
|
||||
* {@link WxConsts.MassMsgType#VOICE}
|
||||
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -22,11 +23,11 @@ public class WxMpMassTagMessage implements Serializable {
|
||||
* <pre>
|
||||
* 消息类型
|
||||
* 请使用
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
|
||||
* {@link WxConsts.MassMsgType#IMAGE}
|
||||
* {@link WxConsts.MassMsgType#MPNEWS}
|
||||
* {@link WxConsts.MassMsgType#TEXT}
|
||||
* {@link WxConsts.MassMsgType#MPVIDEO}
|
||||
* {@link WxConsts.MassMsgType#VOICE}
|
||||
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.chanjar.weixin.mp.bean.kefu;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.builder.kefu.*;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
@@ -90,14 +91,14 @@ public class WxMpKefuMessage implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 请使用
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VOICE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MPNEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_WXCARD}
|
||||
* {@link WxConsts.KefuMsgType#TEXT}
|
||||
* {@link WxConsts.KefuMsgType#IMAGE}
|
||||
* {@link WxConsts.KefuMsgType#VOICE}
|
||||
* {@link WxConsts.KefuMsgType#MUSIC}
|
||||
* {@link WxConsts.KefuMsgType#VIDEO}
|
||||
* {@link WxConsts.KefuMsgType#NEWS}
|
||||
* {@link WxConsts.KefuMsgType#MPNEWS}
|
||||
* {@link WxConsts.KefuMsgType#WXCARD}
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.message;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
@@ -467,13 +468,13 @@ public class WxMpXmlMessage implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 当接受用户消息时,可能会获得以下值:
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LOCATION}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LINK}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_EVENT}
|
||||
* {@link WxConsts.XmlMsgType#TEXT}
|
||||
* {@link WxConsts.XmlMsgType#IMAGE}
|
||||
* {@link WxConsts.XmlMsgType#VOICE}
|
||||
* {@link WxConsts.XmlMsgType#VIDEO}
|
||||
* {@link WxConsts.XmlMsgType#LOCATION}
|
||||
* {@link WxConsts.XmlMsgType#LINK}
|
||||
* {@link WxConsts.XmlMsgType#EVENT}
|
||||
* </pre>
|
||||
*/
|
||||
public String getMsgType() {
|
||||
@@ -483,12 +484,12 @@ public class WxMpXmlMessage implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 当发送消息的时候使用:
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_NEWS}
|
||||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_MUSIC}
|
||||
* {@link WxConsts.XmlMsgType#TEXT}
|
||||
* {@link WxConsts.XmlMsgType#IMAGE}
|
||||
* {@link WxConsts.XmlMsgType#VOICE}
|
||||
* {@link WxConsts.XmlMsgType#VIDEO}
|
||||
* {@link WxConsts.XmlMsgType#NEWS}
|
||||
* {@link WxConsts.XmlMsgType#MUSIC}
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
|
||||
private String mediaId;
|
||||
|
||||
public WxMpXmlOutImageMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_IMAGE;
|
||||
this.msgType = WxConsts.XmlMsgType.IMAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage {
|
||||
protected final Music music = new Music();
|
||||
|
||||
public WxMpXmlOutMusicMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_MUSIC;
|
||||
this.msgType = WxConsts.XmlMsgType.MUSIC;
|
||||
}
|
||||
|
||||
@XStreamAlias("Music")
|
||||
|
||||
@@ -21,7 +21,7 @@ public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
|
||||
protected int articleCount;
|
||||
|
||||
public WxMpXmlOutNewsMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_NEWS;
|
||||
this.msgType = WxConsts.XmlMsgType.NEWS;
|
||||
}
|
||||
|
||||
public void addArticle(Item item) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage {
|
||||
private String content;
|
||||
|
||||
public WxMpXmlOutTextMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_TEXT;
|
||||
this.msgType = WxConsts.XmlMsgType.TEXT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
|
||||
protected TransInfo transInfo;
|
||||
|
||||
public WxMpXmlOutTransferKefuMessage() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_TRANSFER_CUSTOMER_SERVICE;
|
||||
this.msgType = WxConsts.KefuMsgType.TRANSFER_CUSTOMER_SERVICE;
|
||||
}
|
||||
|
||||
@XStreamAlias("TransInfo")
|
||||
|
||||
@@ -19,7 +19,7 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage {
|
||||
protected final Video video = new Video();
|
||||
|
||||
public WxMpXmlOutVideoMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_VIDEO;
|
||||
this.msgType = WxConsts.XmlMsgType.VIDEO;
|
||||
}
|
||||
|
||||
@XStreamAlias("Video")
|
||||
|
||||
@@ -16,7 +16,7 @@ public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage {
|
||||
private String mediaId;
|
||||
|
||||
public WxMpXmlOutVoiceMessage() {
|
||||
this.msgType = WxConsts.XML_MSG_VOICE;
|
||||
this.msgType = WxConsts.XmlMsgType.VOICE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class ImageBuilder extends BaseBuilder<ImageBuilder> {
|
||||
private String mediaId;
|
||||
|
||||
public ImageBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_IMAGE;
|
||||
this.msgType = WxConsts.KefuMsgType.IMAGE;
|
||||
}
|
||||
|
||||
public ImageBuilder mediaId(String media_id) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public final class MpNewsBuilder extends BaseBuilder<MpNewsBuilder> {
|
||||
private String mediaId;
|
||||
|
||||
public MpNewsBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_MPNEWS;
|
||||
this.msgType = WxConsts.KefuMsgType.MPNEWS;
|
||||
}
|
||||
|
||||
public MpNewsBuilder mediaId(String mediaId) {
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class MusicBuilder extends BaseBuilder<MusicBuilder> {
|
||||
private String hqMusicUrl;
|
||||
|
||||
public MusicBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_MUSIC;
|
||||
this.msgType = WxConsts.KefuMsgType.MUSIC;
|
||||
}
|
||||
|
||||
public MusicBuilder musicUrl(String musicurl) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class NewsBuilder extends BaseBuilder<NewsBuilder> {
|
||||
private List<WxMpKefuMessage.WxArticle> articles = new ArrayList<>();
|
||||
|
||||
public NewsBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_NEWS;
|
||||
this.msgType = WxConsts.KefuMsgType.NEWS;
|
||||
}
|
||||
|
||||
public NewsBuilder addArticle(WxMpKefuMessage.WxArticle... articles) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class TextBuilder extends BaseBuilder<TextBuilder> {
|
||||
private String content;
|
||||
|
||||
public TextBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_TEXT;
|
||||
this.msgType = WxConsts.KefuMsgType.TEXT;
|
||||
}
|
||||
|
||||
public TextBuilder content(String content) {
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class VideoBuilder extends BaseBuilder<VideoBuilder> {
|
||||
private String thumbMediaId;
|
||||
|
||||
public VideoBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_VIDEO;
|
||||
this.msgType = WxConsts.KefuMsgType.VIDEO;
|
||||
}
|
||||
|
||||
public VideoBuilder mediaId(String mediaId) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class VoiceBuilder extends BaseBuilder<VoiceBuilder> {
|
||||
private String mediaId;
|
||||
|
||||
public VoiceBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_VOICE;
|
||||
this.msgType = WxConsts.KefuMsgType.VOICE;
|
||||
}
|
||||
|
||||
public VoiceBuilder mediaId(String media_id) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class WxCardBuilder extends BaseBuilder<WxCardBuilder> {
|
||||
private String cardId;
|
||||
|
||||
public WxCardBuilder() {
|
||||
this.msgType = WxConsts.CUSTOM_MSG_WXCARD;
|
||||
this.msgType = WxConsts.KefuMsgType.WXCARD;
|
||||
}
|
||||
|
||||
public WxCardBuilder cardId(String cardId) {
|
||||
|
||||
@@ -23,25 +23,25 @@ public class WxMpKefuMessageGsonAdapter implements JsonSerializer<WxMpKefuMessag
|
||||
messageJson.addProperty("touser", message.getToUser());
|
||||
messageJson.addProperty("msgtype", message.getMsgType());
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.TEXT.equals(message.getMsgType())) {
|
||||
JsonObject text = new JsonObject();
|
||||
text.addProperty("content", message.getContent());
|
||||
messageJson.add("text", text);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.IMAGE.equals(message.getMsgType())) {
|
||||
JsonObject image = new JsonObject();
|
||||
image.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add("image", image);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.VOICE.equals(message.getMsgType())) {
|
||||
JsonObject voice = new JsonObject();
|
||||
voice.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add("voice", voice);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.VIDEO.equals(message.getMsgType())) {
|
||||
JsonObject video = new JsonObject();
|
||||
video.addProperty("media_id", message.getMediaId());
|
||||
video.addProperty("thumb_media_id", message.getThumbMediaId());
|
||||
@@ -50,7 +50,7 @@ public class WxMpKefuMessageGsonAdapter implements JsonSerializer<WxMpKefuMessag
|
||||
messageJson.add("video", video);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_MUSIC.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.MUSIC.equals(message.getMsgType())) {
|
||||
JsonObject music = new JsonObject();
|
||||
music.addProperty("title", message.getTitle());
|
||||
music.addProperty("description", message.getDescription());
|
||||
@@ -60,7 +60,7 @@ public class WxMpKefuMessageGsonAdapter implements JsonSerializer<WxMpKefuMessag
|
||||
messageJson.add("music", music);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.NEWS.equals(message.getMsgType())) {
|
||||
JsonObject newsJsonObject = new JsonObject();
|
||||
JsonArray articleJsonArray = new JsonArray();
|
||||
for (WxMpKefuMessage.WxArticle article : message.getArticles()) {
|
||||
@@ -75,13 +75,13 @@ public class WxMpKefuMessageGsonAdapter implements JsonSerializer<WxMpKefuMessag
|
||||
messageJson.add("news", newsJsonObject);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_MPNEWS.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.MPNEWS.equals(message.getMsgType())) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("media_id", message.getMpNewsMediaId());
|
||||
messageJson.add("mpnews", json);
|
||||
}
|
||||
|
||||
if (WxConsts.CUSTOM_MSG_WXCARD.equals(message.getMsgType())) {
|
||||
if (WxConsts.KefuMsgType.WXCARD.equals(message.getMsgType())) {
|
||||
JsonObject wxcard = new JsonObject();
|
||||
wxcard.addProperty("card_id", message.getCardId());
|
||||
messageJson.add("wxcard", wxcard);
|
||||
|
||||
@@ -26,30 +26,30 @@ public class WxMpMassOpenIdsMessageGsonAdapter implements JsonSerializer<WxMpMas
|
||||
}
|
||||
messageJson.add("touser", toUsers);
|
||||
|
||||
if (WxConsts.MASS_MSG_NEWS.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPNEWS.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_NEWS, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.MPNEWS, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_TEXT.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.TEXT.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("content", message.getContent());
|
||||
messageJson.add(WxConsts.MASS_MSG_TEXT, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.TEXT, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VOICE.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.VOICE.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_VOICE, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.VOICE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_IMAGE.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.IMAGE.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_IMAGE, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.IMAGE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VIDEO.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPVIDEO.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_VIDEO, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.MPVIDEO, sub);
|
||||
}
|
||||
messageJson.addProperty("msgtype", message.getMsgType());
|
||||
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);
|
||||
|
||||
@@ -18,30 +18,30 @@ public class WxMpMassPreviewMessageGsonAdapter implements JsonSerializer<WxMpMas
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("towxname", wxMpMassPreviewMessage.getToWxUserName());
|
||||
jsonObject.addProperty("touser", wxMpMassPreviewMessage.getToWxUserOpenid());
|
||||
if (WxConsts.MASS_MSG_NEWS.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPNEWS.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
JsonObject news = new JsonObject();
|
||||
news.addProperty("media_id", wxMpMassPreviewMessage.getMediaId());
|
||||
jsonObject.add(WxConsts.MASS_MSG_NEWS, news);
|
||||
jsonObject.add(WxConsts.MassMsgType.MPNEWS, news);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_TEXT.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.TEXT.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("content", wxMpMassPreviewMessage.getContent());
|
||||
jsonObject.add(WxConsts.MASS_MSG_TEXT, sub);
|
||||
jsonObject.add(WxConsts.MassMsgType.TEXT, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VOICE.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.VOICE.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId());
|
||||
jsonObject.add(WxConsts.MASS_MSG_VOICE, sub);
|
||||
jsonObject.add(WxConsts.MassMsgType.VOICE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_IMAGE.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.IMAGE.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId());
|
||||
jsonObject.add(WxConsts.MASS_MSG_IMAGE, sub);
|
||||
jsonObject.add(WxConsts.MassMsgType.IMAGE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VIDEO.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPVIDEO.equals(wxMpMassPreviewMessage.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId());
|
||||
jsonObject.add(WxConsts.MASS_MSG_VIDEO, sub);
|
||||
jsonObject.add(WxConsts.MassMsgType.MPVIDEO, sub);
|
||||
}
|
||||
jsonObject.addProperty("msgtype", wxMpMassPreviewMessage.getMsgType());
|
||||
return jsonObject;
|
||||
|
||||
@@ -32,30 +32,30 @@ public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTag
|
||||
}
|
||||
messageJson.add("filter", filter);
|
||||
|
||||
if (WxConsts.MASS_MSG_NEWS.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPNEWS.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_NEWS, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.MPNEWS, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_TEXT.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.TEXT.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("content", message.getContent());
|
||||
messageJson.add(WxConsts.MASS_MSG_TEXT, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.TEXT, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VOICE.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.VOICE.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_VOICE, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.VOICE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_IMAGE.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.IMAGE.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_IMAGE, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.IMAGE, sub);
|
||||
}
|
||||
if (WxConsts.MASS_MSG_VIDEO.equals(message.getMsgType())) {
|
||||
if (WxConsts.MassMsgType.MPVIDEO.equals(message.getMsgType())) {
|
||||
JsonObject sub = new JsonObject();
|
||||
sub.addProperty("media_id", message.getMediaId());
|
||||
messageJson.add(WxConsts.MASS_MSG_VIDEO, sub);
|
||||
messageJson.add(WxConsts.MassMsgType.MPVIDEO, sub);
|
||||
}
|
||||
messageJson.addProperty("msgtype", message.getMsgType());
|
||||
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);
|
||||
|
||||
Reference in New Issue
Block a user