Skip to content

Commit

Permalink
🎨 #2077 【开放平台】代小程序实现业务获取基本信息接口新增nickname相关字段
Browse files Browse the repository at this point in the history
  • Loading branch information
BrighterAmmo authored Apr 15, 2021
1 parent d818d57 commit 6f24f7b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* 微信认证信息
Expand All @@ -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 {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<WxFastMaAccountBasicInfoResult.NicknameInfo>() {
}.getType());
accountBasicInfo.setNicknameInfo(nicknameInfo);

WxFastMaAccountBasicInfoResult.WxVerifyInfo verifyInfo = WxOpenGsonBuilder.create()
.fromJson(jsonObject.get("wx_verify_info"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit 6f24f7b

Please sign in to comment.