mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 10:15:08 +08:00
#674 修复微信返回0/1值转换为布尔值错误的问题
This commit is contained in:
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.util.json;
|
|||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ public class WxMpMassNewsArticleGsonAdapter implements JsonSerializer<WxMpMassNe
|
|||||||
}
|
}
|
||||||
JsonElement showCoverPic = articleInfo.get("show_cover_pic");
|
JsonElement showCoverPic = articleInfo.get("show_cover_pic");
|
||||||
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
||||||
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
|
article.setShowCoverPic(BooleanUtils.toBoolean(showCoverPic.getAsInt()));
|
||||||
}
|
}
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
|||||||
}
|
}
|
||||||
JsonElement showCoverPic = articleInfo.get("show_cover_pic");
|
JsonElement showCoverPic = articleInfo.get("show_cover_pic");
|
||||||
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
||||||
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
|
article.setShowCoverPic(BooleanUtils.toBoolean(showCoverPic.getAsInt()));
|
||||||
}
|
}
|
||||||
JsonElement url = articleInfo.get("url");
|
JsonElement url = articleInfo.get("url");
|
||||||
if (url != null && !url.isJsonNull()) {
|
if (url != null && !url.isJsonNull()) {
|
||||||
@@ -87,12 +87,12 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
|||||||
|
|
||||||
JsonElement needOpenComment = articleInfo.get("need_open_comment");
|
JsonElement needOpenComment = articleInfo.get("need_open_comment");
|
||||||
if (needOpenComment != null && !needOpenComment.isJsonNull()) {
|
if (needOpenComment != null && !needOpenComment.isJsonNull()) {
|
||||||
article.setNeedOpenComment(GsonHelper.getAsBoolean(needOpenComment));
|
article.setNeedOpenComment(BooleanUtils.toBoolean(needOpenComment.getAsInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonElement onlyFansCanComment = articleInfo.get("only_fans_can_comment");
|
JsonElement onlyFansCanComment = articleInfo.get("only_fans_can_comment");
|
||||||
if (onlyFansCanComment != null && !onlyFansCanComment.isJsonNull()) {
|
if (onlyFansCanComment != null && !onlyFansCanComment.isJsonNull()) {
|
||||||
article.setOnlyFansCanComment(GsonHelper.getAsBoolean(onlyFansCanComment));
|
article.setOnlyFansCanComment(BooleanUtils.toBoolean(onlyFansCanComment.getAsInt()));
|
||||||
}
|
}
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user