mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-01 20:13:12 +08:00
#932 增加第三方平台快速创建小程序接口及相关的信息设置接口
* Add 接收API创建小程序成功的消息推送
实现快速创建小程序的新建、查询接口
增加WxOpenFastMaService(API创建的小程序专用的接口)
* Add 实现小程序名称设置及改名、微信认证名称检测、修改头像、修改功能介绍接口
* Add 实现所有通过API创建的小程序专属接口及相关结果类
* Add 添加三个复杂实体的单体测试
* Update 修复WxFastMaService 8.1接口:因为不同类目含有特定字段,目前没有完整的类目信息数据,为保证兼容性,放弃将response转换为实体
* Update 将快速创建小程序接口返回值更改为WxOpenResult
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
package me.chanjar.weixin.open.bean.result;
|
||||
|
||||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
||||
public class WxFastMaAccountBasicInfoResultTest {
|
||||
@Test
|
||||
public void testFromJson() throws Exception {
|
||||
String json = "{\n" +
|
||||
" \"errcode\": 0,\n" +
|
||||
" \"errmsg\": \"ok\",\n" +
|
||||
"\t\"appid\": \"wxdc685123d955453\",\n" +
|
||||
" \"account_type\": 2,\n" +
|
||||
"\t\"principal_type\": 1,\n" +
|
||||
"\t\"principal_name\": \"深圳市腾讯计算机系统有限公司\",\n" +
|
||||
" \"realname_status\": 1,\n" +
|
||||
" \"wx_verify_info\": {\n" +
|
||||
" \"qualification_verify\": true,\n" +
|
||||
" \"naming_verify\": true,\n" +
|
||||
" \"annual_review\": true,\n" +
|
||||
" \"annual_review_begin_time\": 1550490981,\n" +
|
||||
" \"annual_review_end_time\": 1558266981\n" +
|
||||
" },\n" +
|
||||
" \"signature_info\": {\n" +
|
||||
" \"signature\": \"功能介绍\",\n" +
|
||||
" \"modify_used_count\": 1,\n" +
|
||||
" \"modify_quota\": 5\n" +
|
||||
" },\n" +
|
||||
"\t\"head_image_info\": {\n" +
|
||||
" \"head_image_url\": \"http://mmbiz.qpic.cn/mmbiz/a5icZrUmbV8p5jb6RZ8aYfjfS2AVle8URwBt8QIu6XbGewB9wiaWYWkPwq4R7pfdsFibuLkic16UcxDSNYtB8HnC1Q/0\",\n" +
|
||||
" \"modify_used_count\": 3,\n" +
|
||||
" \"modify_quota\": 5\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
WxFastMaAccountBasicInfoResult res = WxOpenGsonBuilder.create ().fromJson (json, WxFastMaAccountBasicInfoResult.class);
|
||||
|
||||
assertNotNull(res);
|
||||
assertNotNull(res.getAppId ());
|
||||
assertNotNull(res.getSignatureInfo ().getModifyQuota ());
|
||||
assertNotNull(res.getHeadImageInfo ().getHeadImageUrl ());
|
||||
assertNotNull(res.getWxVerifyInfo ().getNamingVerify ());
|
||||
assertTrue(res.getWxVerifyInfo ().getNamingVerify ());
|
||||
System.out.println(res);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package me.chanjar.weixin.open.bean.result;
|
||||
|
||||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
||||
public class WxFastMaBeenSetCategoryResultTest {
|
||||
@Test
|
||||
public void testFromJson() throws Exception {
|
||||
String json = "{\n" +
|
||||
" \"errcode\": 0,\n" +
|
||||
" \"errmsg\":\"ok\",\n" +
|
||||
" \"categories\": [\n" +
|
||||
" {\n" +
|
||||
" \"first\": 8,\n" +
|
||||
" \"first_name\": \"教育\",\n" +
|
||||
" \"second\": 39,\n" +
|
||||
" \"second_name\": \"出国移民\",\n" +
|
||||
" \"audit_status\": 1,\n" +
|
||||
" \"audit_reason\": \"不通过啊啊\"\n" +
|
||||
" }\n" +
|
||||
" ],\n" +
|
||||
"\t\"limit\": 5,\n" +
|
||||
" \"quota\": 4,\n" +
|
||||
" \"category_limit\": 20\n" +
|
||||
"}";
|
||||
|
||||
WxFastMaBeenSetCategoryResult res = WxOpenGsonBuilder.create ().fromJson (json, WxFastMaBeenSetCategoryResult.class);
|
||||
|
||||
assertNotNull(res);
|
||||
assertTrue(res.getCategories ().size ()> 0);
|
||||
assertNotNull(res.getCategories ().get (0));
|
||||
assertNotNull(res.getCategories ().get (0).getFirstName ());
|
||||
System.out.println(res);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package me.chanjar.weixin.open.bean.result;
|
||||
|
||||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
|
||||
public class WxFastMaCanSetCategoryResultTest {
|
||||
@Test
|
||||
public void testFromJson() throws Exception {
|
||||
String json = "{\n" +
|
||||
" \"errcode\": 0, \n" +
|
||||
" \"errmsg\": \"ok\", \n" +
|
||||
" \"categories_list\": {\n" +
|
||||
" \"categories\": [\n" +
|
||||
" {\n" +
|
||||
" \"id\": 1, \n" +
|
||||
" \"name\": \"快递业与邮政\", \n" +
|
||||
" \"level\": 1, \n" +
|
||||
" \"father\": 0, \n" +
|
||||
" \"children\": [\n" +
|
||||
" 2, \n" +
|
||||
" 5, \n" +
|
||||
" 556, \n" +
|
||||
" 558, \n" +
|
||||
" 1033\n" +
|
||||
" ], \n" +
|
||||
" \"sensitive_type\": 0, \n" +
|
||||
" \"type_list\": [ ], \n" +
|
||||
" \"qualify\": {\n" +
|
||||
" \"exter_list\": [ ], \n" +
|
||||
" \"remark\": \"\"\n" +
|
||||
" }, \n" +
|
||||
" \"available_api_list\": [ ], \n" +
|
||||
" \"apis\": [ ], \n" +
|
||||
" \"available_for_plugin\": true\n" +
|
||||
" }, \n" +
|
||||
" {\n" +
|
||||
" \"id\": 8, \n" +
|
||||
" \"name\": \"教育\", \n" +
|
||||
" \"level\": 1, \n" +
|
||||
" \"father\": 0, \n" +
|
||||
" \"children\": [\n" +
|
||||
" 9, \n" +
|
||||
" 590, \n" +
|
||||
" 592, \n" +
|
||||
" 27, \n" +
|
||||
" 32, \n" +
|
||||
" 37, \n" +
|
||||
" 39, \n" +
|
||||
" 578, \n" +
|
||||
" 580, \n" +
|
||||
" 582, \n" +
|
||||
" 1043\n" +
|
||||
" ], \n" +
|
||||
" \"sensitive_type\": 0, \n" +
|
||||
" \"type_list\": [ ], \n" +
|
||||
" \"qualify\": {\n" +
|
||||
" \"exter_list\": [ ], \n" +
|
||||
" \"remark\": \"\"\n" +
|
||||
" }, \n" +
|
||||
" \"is_hidden\": false, \n" +
|
||||
" \"available_api_list\": [ ], \n" +
|
||||
" \"type\": \"NORMAL\", \n" +
|
||||
" \"apis\": [ ], \n" +
|
||||
" \"available_for_plugin\": true\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
WxFastMaCanSetCategoryResult res = WxOpenGsonBuilder.create ().fromJson (json, WxFastMaCanSetCategoryResult.class);
|
||||
|
||||
assertNotNull(res);
|
||||
assertNotNull(res.getCategoriesList ());
|
||||
System.out.println(res);
|
||||
}
|
||||
|
||||
}
|
||||
13
weixin-java-open/src/test/resources/logback-test.xml
Normal file
13
weixin-java-open/src/test/resources/logback-test.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %replace(%caller{1}){'Caller', ''} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@ -0,0 +1,7 @@
|
||||
<xml>
|
||||
<componentAppId>第三方平台appID</componentAppId>
|
||||
<componentSecret>第三方平台appsecret</componentSecret>
|
||||
<componentToken>第三方平台Token</componentToken>
|
||||
<componentAesKey>第三方平台EncodingAESKey</componentAesKey>
|
||||
<appId>测试APPID</appId>
|
||||
</xml>
|
||||
11
weixin-java-open/src/test/resources/testng.xml
Normal file
11
weixin-java-open/src/test/resources/testng.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="Weixin-java-tool-suite" verbose="1">
|
||||
<test name="Result_Test">
|
||||
<classes>
|
||||
<class name="me.chanjar.weixin.open.bean.result.WxFastMaAccountBasicInfoResultTest"/>
|
||||
<class name="me.chanjar.weixin.open.bean.result.WxFastMaCanSetCategoryResultTest"/>
|
||||
<class name="me.chanjar.weixin.open.bean.result.WxFastMaBeenSetCategoryResultTest"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
Reference in New Issue
Block a user