🐛 #3389 【小程序】修复获取帐号基本信息的结果中customerType等字段为null的问题

This commit is contained in:
Molzx 2024-10-16 21:00:33 +08:00 committed by GitHub
parent 20688541aa
commit 948cfbb310
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 57 deletions

View File

@ -1,56 +0,0 @@
package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.result.WxFastMaAccountBasicInfoResult;
import java.lang.reflect.Type;
/**
* .
*
* @author Hipple
* @since 2019/1/23 15:02
*/
public class WxFastMaAccountBasicInfoGsonAdapter implements JsonDeserializer<WxFastMaAccountBasicInfoResult> {
@Override
public WxFastMaAccountBasicInfoResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
throws JsonParseException {
WxFastMaAccountBasicInfoResult accountBasicInfo = new WxFastMaAccountBasicInfoResult();
JsonObject jsonObject = jsonElement.getAsJsonObject();
accountBasicInfo.setAppId(GsonHelper.getString(jsonObject, "appid"));
accountBasicInfo.setAccountType(GsonHelper.getInteger(jsonObject, "account_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"),
new TypeToken<WxFastMaAccountBasicInfoResult.WxVerifyInfo>() {
}.getType());
accountBasicInfo.setWxVerifyInfo(verifyInfo);
WxFastMaAccountBasicInfoResult.SignatureInfo signatureInfo = WxOpenGsonBuilder.create()
.fromJson(jsonObject.get("signature_info"),
new TypeToken<WxFastMaAccountBasicInfoResult.SignatureInfo>() {
}.getType());
accountBasicInfo.setSignatureInfo(signatureInfo);
WxFastMaAccountBasicInfoResult.HeadImageInfo headImageInfo = WxOpenGsonBuilder.create()
.fromJson(jsonObject.get("head_image_info"),
new TypeToken<WxFastMaAccountBasicInfoResult.HeadImageInfo>() {
}.getType());
accountBasicInfo.setHeadImageInfo(headImageInfo);
return accountBasicInfo;
}
}

View File

@ -26,7 +26,6 @@ public class WxOpenGsonBuilder {
INSTANCE.registerTypeAdapter(WxOpenQueryAuthResult.class, new WxOpenQueryAuthResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerInfoResult.class, new WxOpenAuthorizerInfoResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerOptionResult.class, new WxOpenAuthorizerOptionResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxFastMaAccountBasicInfoResult.class, new WxFastMaAccountBasicInfoGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerListResult.class, new WxOpenAuthorizerListResultGsonAdapter());
}