#932 增加第三方平台快速创建小程序接口及相关的信息设置接口

* Add 接收API创建小程序成功的消息推送
     实现快速创建小程序的新建、查询接口
     增加WxOpenFastMaService(API创建的小程序专用的接口)

* Add 实现小程序名称设置及改名、微信认证名称检测、修改头像、修改功能介绍接口

* Add 实现所有通过API创建的小程序专属接口及相关结果类

* Add 添加三个复杂实体的单体测试

* Update 修复WxFastMaService 8.1接口:因为不同类目含有特定字段,目前没有完整的类目信息数据,为保证兼容性,放弃将response转换为实体

* Update 将快速创建小程序接口返回值更改为WxOpenResult
This commit is contained in:
Hipple
2019-01-27 15:18:47 +08:00
committed by Binary Wang
parent cf549eaed3
commit 014fb28354
20 changed files with 1247 additions and 12 deletions

View File

@@ -0,0 +1,44 @@
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
* @description
* @since 2019/1/23 15:02
*/
public class WxFastMaAccountBasicInfoGsonAdapter implements JsonDeserializer<WxFastMaAccountBasicInfoResult> {
@Override
public WxFastMaAccountBasicInfoResult deserialize (JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) 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"));
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

@@ -6,6 +6,7 @@ import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizerInfo;
import me.chanjar.weixin.open.bean.result.WxFastMaAccountBasicInfoResult;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerInfoResult;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerOptionResult;
import me.chanjar.weixin.open.bean.result.WxOpenQueryAuthResult;
@@ -27,6 +28,8 @@ public class WxOpenGsonBuilder {
INSTANCE.registerTypeAdapter(WxOpenAuthorizerInfoResult.class, new WxOpenAuthorizerInfoResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerOptionResult.class, new WxOpenAuthorizerOptionResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxFastMaAccountBasicInfoResult.class, new WxFastMaAccountBasicInfoGsonAdapter ());
}
public static Gson create() {