Skip to content

🎨 Fix #2660:补全了开放平台获取授权帐号详情部分参数 #2683

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
Jun 10, 2022
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 @@ -43,6 +43,27 @@ public class WxOpenAuthorizerInfo implements Serializable {
*/
private MiniProgramInfo miniProgramInfo;

/**
* 小程序注册方式
* 类型 说明
* 0 普通方式注册
* 2 通过复用公众号创建小程序 api 注册
* 6 通过法人扫脸创建企业小程序 api 注册
* 13 通过创建试用小程序 api 注册
* 15 通过联盟控制台注册
* 16 通过创建个人小程序 api 注册
* 17 通过创建个人交易小程序 api 注册
* 19 通过试用小程序转正 api 注册
* 22 通过复用商户号创建企业小程序 api 注册
* 23 通过复用商户号转正 api 注册
*/
private Integer registerType;

/**
* 小程序基础配置信息
*/
private BasicConfig basicConfig;

@Data
public static class MiniProgramInfo implements Serializable {
private static final long serialVersionUID = 8857028017332191988L;
Expand Down Expand Up @@ -76,4 +97,13 @@ public static class Network implements Serializable {
private List<String> bizDomain;
}
}

@Data
public static class BasicConfig implements Serializable {
private static final long serialVersionUID = -8857028017332191989L;
@SerializedName("is_phone_configured")
private Boolean isPhoneConfigured;
@SerializedName("is_email_configured")
private Boolean isEmailConfigured;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class WxOpenAuthorizerInfoGsonAdapter implements JsonDeserializer<WxOpenA
private static final String VERIFY_TYPE_INFO = "verify_type_info";
private static final String SERVICE_TYPE_INFO = "service_type_info";
private static final String MINI_PROGRAM_INFO = "MiniProgramInfo";
private static final String BASIC_CONFIG = "basic_config";

@Override
public WxOpenAuthorizerInfo deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
Expand All @@ -30,14 +31,19 @@ public WxOpenAuthorizerInfo deserialize(JsonElement jsonElement, Type type, Json
authorizationInfo.setQrcodeUrl(GsonHelper.getString(jsonObject, "qrcode_url"));
authorizationInfo.setAccountStatus(GsonHelper.getInteger(jsonObject, "account_status"));
authorizationInfo.setSignature(GsonHelper.getString(jsonObject, "signature"));
authorizationInfo.setAccountStatus(GsonHelper.getInteger(jsonObject, "account_status"));
authorizationInfo.setRegisterType(GsonHelper.getInteger(jsonObject, "register_type"));

if (jsonObject.has(SERVICE_TYPE_INFO)) {
authorizationInfo.setServiceTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject(SERVICE_TYPE_INFO), "id"));
}
if (jsonObject.has(VERIFY_TYPE_INFO)) {
authorizationInfo.setVerifyTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject(VERIFY_TYPE_INFO), "id"));
}
if(jsonObject.has(BASIC_CONFIG)){
authorizationInfo.setBasicConfig(WxOpenGsonBuilder.create().fromJson(jsonObject.get(BASIC_CONFIG),
new TypeToken<WxOpenAuthorizerInfo.BasicConfig>(){
}.getType()));
}
Map<String, Integer> businessInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("business_info"),
new TypeToken<Map<String, Integer>>() {
}.getType());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package me.chanjar.weixin.open.bean.result;

import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.testng.annotations.Test;

/**
* @title: 获取授权帐号详情 信息反序列化测试
* @author: trifolium
* @date: 2022/6/7
* @modified :
*/
public class WxOpenAuthorizerInfoResultTest {

@Test
public void testDeserialization() {

String json = "{\n" +
" \"authorizer_info\": {\n" +
" \"nick_name\": \"美妆饰品\",\n" +
" \"head_img\": \"http:\\/\\/wx.qlogo.cn\\/mmopen\\/jJSbu4Te5iuiaM0dFnKVUEE83n2yH5cQStb\\/0\",\n" +
" \"service_type_info\": {\n" +
" \"id\": 0\n" +
" },\n" +
" \"verify_type_info\": {\n" +
" \"id\": -1\n" +
" },\n" +
" \"user_name\": \"gh_c43395cb652e\",\n" +
" \"alias\": \"\",\n" +
" \"qrcode_url\": \"http:\\/\\/mmbiz.qpic.cn\\/mmbiz_jpg\\/kPmmhe6g\\/0\",\n" +
" \"business_info\": {\n" +
" \"open_pay\": 0,\n" +
" \"open_shake\": 0,\n" +
" \"open_scan\": 0,\n" +
" \"open_card\": 0,\n" +
" \"open_store\": 0\n" +
" },\n" +
" \"idc\": 1,\n" +
" \"principal_name\": \"个人\",\n" +
" \"signature\": \"做美装,精美饰品等搭配教学\",\n" +
" \"MiniProgramInfo\": {\n" +
" \"network\": {\n" +
" \"RequestDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"WsRequestDomain\": [\"wss:\\/\\/weixin.qq.com\"],\n" +
" \"UploadDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"DownloadDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"BizDomain\": [],\n" +
" \"UDPDomain\": [],\n" +
" \"TCPDomain\": [],\n" +
" \"PrefetchDNSDomain\": [],\n" +
" \"NewRequestDomain\": [],\n" +
" \"NewWsRequestDomain\": [],\n" +
" \"NewUploadDomain\": [],\n" +
" \"NewDownloadDomain\": [],\n" +
" \"NewBizDomain\": [],\n" +
" \"NewUDPDomain\": [],\n" +
" \"NewTCPDomain\": [],\n" +
" \"NewPrefetchDNSDomain\": []\n" +
" },\n" +
" \"categories\": [{\n" +
" \"first\": \"生活服务\",\n" +
" \"second\": \"丽人服务\"\n" +
" }, {\n" +
" \"first\": \"旅游服务\",\n" +
" \"second\": \"旅游资讯\"\n" +
" }, {\n" +
" \"first\": \"物流服务\",\n" +
" \"second\": \"查件\"\n" +
" }],\n" +
" \"visit_status\": 0\n" +
" },\n" +
" \"register_type\": 0,\n" +
" \"account_status\": 1,\n" +
" \"basic_config\": {\n" +
" \"is_phone_configured\": true,\n" +
" \"is_email_configured\": true\n" +
" }\n" +
" },\n" +
" \"authorization_info\": {\n" +
" \"authorizer_appid\": \"wx326eecacf7370d4e\",\n" +
" \"authorizer_refresh_token\": \"refreshtoken@@@RU0Sgi7bD6apS7frS9gj8Sbws7OoDejK9Z-cm0EnCzg\",\n" +
" \"func_info\": [{\n" +
" \"funcscope_category\": {\n" +
" \"id\": 3\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 7\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 17\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 18\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 19\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 30\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 115\n" +
" }\n" +
" }]\n" +
" }\n" +
"}\n";

System.out.println(WxOpenGsonBuilder.create().fromJson(json, WxOpenAuthorizerInfoResult.class));
}

}