From 6f24f7b92e66671d9f3352919e8638c2c184197e Mon Sep 17 00:00:00 2001 From: shzyx122 <38214419+shzyx122@users.noreply.github.com> Date: Fri, 16 Apr 2021 00:16:33 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#2077=20=E3=80=90=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E4=BB=A3=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=B8=9A=E5=8A=A1=E8=8E=B7=E5=8F=96=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E?= =?UTF-8?q?nickname=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 返回参数: nickname_info 名称信息,nickname 小程序名称 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Mini_Program_Information_Settings.html --- .../WxFastMaAccountBasicInfoResult.java | 31 +++++++++++++++++++ .../WxFastMaAccountBasicInfoGsonAdapter.java | 7 +++++ .../WxFastMaAccountBasicInfoResultTest.java | 11 ++++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResult.java index 11382889ff..66783f2fd8 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResult.java @@ -45,6 +45,17 @@ public class WxFastMaAccountBasicInfoResult extends WxOpenResult { @SerializedName("realname_status") private Integer realnameStatus; + /** + * 小程序名称 + */ + @SerializedName("nickname") + private String nickname; + + /** + * 名称信息 + */ + @SerializedName("nickname_info") + private NicknameInfo nicknameInfo; /** * 微信认证信息 @@ -62,6 +73,26 @@ public class WxFastMaAccountBasicInfoResult extends WxOpenResult { @SerializedName("head_image_info") private HeadImageInfo headImageInfo; + @Data + public static class NicknameInfo { + /** + * 小程序名称 + */ + @SerializedName("nickname") + private String nickname; + /** + * 小程序名称已使用修改次数(本年) + */ + @SerializedName("modify_used_count") + private Integer modifyUsedCount; + /** + * 小程序名称修改次数总额度(本年) + */ + @SerializedName("modify_quota") + private Integer modifyQuota; + } + + @Data public static class WxVerifyInfo { /** diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxFastMaAccountBasicInfoGsonAdapter.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxFastMaAccountBasicInfoGsonAdapter.java index c774d8f047..2a4795aba4 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxFastMaAccountBasicInfoGsonAdapter.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxFastMaAccountBasicInfoGsonAdapter.java @@ -25,6 +25,13 @@ public WxFastMaAccountBasicInfoResult deserialize(JsonElement jsonElement, Type accountBasicInfo.setPrincipalType(GsonHelper.getInteger(jsonObject, "principal_type")); accountBasicInfo.setPrincipalName(GsonHelper.getString(jsonObject, "principal_name")); accountBasicInfo.setRealnameStatus(GsonHelper.getInteger(jsonObject, "realname_status")); + accountBasicInfo.setNickname(GsonHelper.getString(jsonObject, "nickname")); + + WxFastMaAccountBasicInfoResult.NicknameInfo nicknameInfo = WxOpenGsonBuilder.create() + .fromJson(jsonObject.get("nickname_info"), + new TypeToken() { + }.getType()); + accountBasicInfo.setNicknameInfo(nicknameInfo); WxFastMaAccountBasicInfoResult.WxVerifyInfo verifyInfo = WxOpenGsonBuilder.create() .fromJson(jsonObject.get("wx_verify_info"), diff --git a/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java b/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java index 851620f9ed..b08545f603 100644 --- a/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java +++ b/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java @@ -34,7 +34,14 @@ public void testFromJson() throws Exception { " \"head_image_url\": \"http://mmbiz.qpic.cn/mmbiz/a5icZrUmbV8p5jb6RZ8aYfjfS2AVle8URwBt8QIu6XbGewB9wiaWYWkPwq4R7pfdsFibuLkic16UcxDSNYtB8HnC1Q/0\",\n" + " \"modify_used_count\": 3,\n" + " \"modify_quota\": 5\n" + - " }\n" + + " },\n" + + + "\t\"nickname_info\": {\n" + + " \"nickname\": \"nickey\",\n" + + " \"modify_used_count\": 2,\n" + + " \"modify_quota\": 2\n" + + " },\n" + + " \"nickname\": \"nickeyInfo\"\n" + "}"; WxFastMaAccountBasicInfoResult res = WxOpenGsonBuilder.create().fromJson(json, WxFastMaAccountBasicInfoResult.class); @@ -45,6 +52,8 @@ public void testFromJson() throws Exception { assertNotNull(res.getHeadImageInfo().getHeadImageUrl()); assertNotNull(res.getWxVerifyInfo().getNamingVerify()); assertTrue(res.getWxVerifyInfo().getNamingVerify()); + assertNotNull(res.getNicknameInfo().getNickname()); + assertNotNull(res.getNickname()); System.out.println(res); }