格式化开放平台模块代码

This commit is contained in:
Binary Wang
2017-11-14 11:07:31 +08:00
parent 993999735b
commit e00e7bb0ca
20 changed files with 152 additions and 86 deletions

View File

@@ -2,6 +2,7 @@ package me.chanjar.weixin.open.util;
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
import org.apache.commons.codec.binary.Base64;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/

View File

@@ -22,18 +22,18 @@ public class WxOpenAuthorizationInfoGsonAdapter implements JsonDeserializer<WxOp
authorizationInfo.setAuthorizerRefreshToken(GsonHelper.getString(jsonObject, "authorizer_refresh_token"));
List<Integer> funcInfo = new ArrayList<>();
JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject.get("func_info"));
if(jsonArray != null && !jsonArray.isJsonNull()){
for(int i = 0; i < jsonArray.size(); i++){
if (jsonArray != null && !jsonArray.isJsonNull()) {
for (int i = 0; i < jsonArray.size(); i++) {
jsonObject = jsonArray.get(i).getAsJsonObject();
if(jsonObject == null || jsonObject.isJsonNull()){
if (jsonObject == null || jsonObject.isJsonNull()) {
continue;
}
jsonObject = jsonObject.getAsJsonObject("funcscope_category");
if(jsonObject == null || jsonObject.isJsonNull()){
if (jsonObject == null || jsonObject.isJsonNull()) {
continue;
}
Integer id = GsonHelper.getInteger(jsonObject, "id");
if(id == null) {
if (id == null) {
continue;
}
funcInfo.add(id);

View File

@@ -23,10 +23,10 @@ public class WxOpenAuthorizerInfoGsonAdapter implements JsonDeserializer<WxOpenA
authorizationInfo.setPrincipalName(GsonHelper.getString(jsonObject, "principal_name"));
authorizationInfo.setAlias(GsonHelper.getString(jsonObject, "alias"));
authorizationInfo.setQrcodeUrl(GsonHelper.getString(jsonObject, "qrcode_url"));
if(jsonObject.has("service_type_info")) {
if (jsonObject.has("service_type_info")) {
authorizationInfo.setServiceTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject("service_type_info"), "id"));
}
if(jsonObject.has("verify_type_info")) {
if (jsonObject.has("verify_type_info")) {
authorizationInfo.setVerifyTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject("verify_type_info"), "id"));
}
Map<String, Integer> businessInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("business_info"),