Skip to content

【开放平台】代小程序实现业务-基础信息设置 增加名称信息字段 #2077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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