mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
add unionid
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
package me.chanjar.weixin.mp.util.json;
|
||||
|
||||
import com.google.gson.*;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class WxMpOAuth2AccessTokenAdapter implements JsonDeserializer<WxMpOAuth2AccessToken> {
|
||||
|
||||
public WxMpOAuth2AccessToken deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws
|
||||
@@ -28,6 +33,9 @@ public class WxMpOAuth2AccessTokenAdapter implements JsonDeserializer<WxMpOAuth2
|
||||
if (accessTokenJsonObject.get("scope") != null && !accessTokenJsonObject.get("scope").isJsonNull()) {
|
||||
accessToken.setScope(GsonHelper.getAsString(accessTokenJsonObject.get("scope")));
|
||||
}
|
||||
if (accessTokenJsonObject.get("unionid") != null && !accessTokenJsonObject.get("unionid").isJsonNull()) {
|
||||
accessToken.setUnionId(GsonHelper.getAsString(accessTokenJsonObject.get("unionid")));
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user