重构WxConsts类,对所有常量进行分类整理,便于阅读使用

This commit is contained in:
Binary Wang
2017-11-07 11:41:55 +08:00
parent f65e2fbdb8
commit 2146372502
62 changed files with 427 additions and 393 deletions

View File

@@ -37,13 +37,13 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
if (StringUtils.isNotBlank(message.getToTag())) {
messageJson.addProperty("totag", message.getToTag());
}
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_TEXTCARD.equals(message.getMsgType())) {
if (WxConsts.KefuMsgType.TEXTCARD.equals(message.getMsgType())) {
JsonObject text = new JsonObject();
text.addProperty("title", message.getTitle());
text.addProperty("description", message.getDescription());
@@ -51,19 +51,19 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
messageJson.add("textcard", 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_FILE.equals(message.getMsgType())) {
if (WxConsts.KefuMsgType.FILE.equals(message.getMsgType())) {
JsonObject image = new JsonObject();
image.addProperty("media_id", message.getMediaId());
messageJson.add("file", 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);
@@ -73,7 +73,7 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
messageJson.addProperty("safe", message.getSafe());
}
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());
@@ -82,7 +82,7 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
messageJson.add("video", video);
}
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
if (WxConsts.KefuMsgType.NEWS.equals(message.getMsgType())) {
JsonObject newsJsonObject = new JsonObject();
JsonArray articleJsonArray = new JsonArray();
for (NewArticle article : message.getArticles()) {
@@ -97,7 +97,7 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
messageJson.add("news", newsJsonObject);
}
if (WxConsts.CUSTOM_MSG_MPNEWS.equals(message.getMsgType())) {
if (WxConsts.KefuMsgType.MPNEWS.equals(message.getMsgType())) {
JsonObject newsJsonObject = new JsonObject();
if (message.getMediaId() != null) {
newsJsonObject.addProperty("media_id", message.getMediaId());