diff --git a/README.md b/README.md
index ebb1d0f0..417c4252 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ weixin-popular 包括微信公众平台、公众号第三方平台基础API与
com.github.liyiorg
weixin-popular
- 2.8.0
+ 2.8.1
```
* [升级注意事项](https://github.com/liyiorg/weixin-popular/wiki/jar_update)
@@ -37,15 +37,15 @@ weixin-popular 包括微信公众平台、公众号第三方平台基础API与
* [ClearQuotaAPI](https://github.com/liyiorg/weixin-popular/wiki/ClearQuotaAPI) 接口调用频次清零
* [PoiAPI](https://github.com/liyiorg/weixin-popular/wiki/PoiAPI) 微信门店 @Moyq5 (贡献)
* [CardAPI](https://github.com/liyiorg/weixin-popular/wiki/CardAPI) 微信卡券 @Moyq5 (贡献)
+* [ShakearoundAPI](https://github.com/liyiorg/weixin-popular/wiki/ShakearoundAPI) 微信摇一摇周边 @Moyq5 (贡献)
+* [DatacubeAPI](https://github.com/liyiorg/weixin-popular/wiki/DatacubeAPI) 数据统计 @Moyq5 (贡献)
### 待开发API
* [BizwifiAPI](https://github.com/liyiorg/weixin-popular/wiki/BizwifiAPI) 微信连Wi-Fi
* [CustomserviceAPI](https://github.com/liyiorg/weixin-popular/wiki/CustomserviceAPI) 多客服功能
-* [DatacubeAPI](https://github.com/liyiorg/weixin-popular/wiki/DatacubeAPI) 数据统计
* [MerchantAPI](https://github.com/liyiorg/weixin-popular/wiki/MerchantAPI) 微信小店
* [ScanAPI](https://github.com/liyiorg/weixin-popular/wiki/ScanAPI) 微信扫一扫
* [SemanticAPI](https://github.com/liyiorg/weixin-popular/wiki/SemanticAPI) 微信智能
-* [ShakearoundAPI](https://github.com/liyiorg/weixin-popular/wiki/ShakearoundAPI) 微信摇一摇周边
* [DeviceAPI](https://github.com/liyiorg/weixin-popular/wiki/DeviceAPI) 设备功能
## API 模式切换
diff --git a/changelog.txt b/changelog.txt
index 200be510..ac17265f 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,13 +2,17 @@ WEIXIN-POPULAR CHANGELOG
===========================
https://github.com/liyiorg/weixin-popular
-Changes in version 2.8.1-SNAPSHOT (2016-07-22)
+Changes in version 2.8.1 (2016-09-21)
-------------------------------------
*
* 添加PoiAPI 门店接口
* 添加CardAPI 卡卷接口
+* 添加ShakeAroundAPI 微信摇一摇周边
+* 添加DataCubeAPI 数据统计接口
+* UserAPI 添加用户标签、黑名单接口
* 更新 JsUtil.generateChooseWXPayJson 生成JS支付JSON数据
* MaterialAPI issue #38 修复
+* TokenAPI TicketAPI issue #53 修复
Changes in version 2.8.0 (2016-05-24)
-------------------------------------
diff --git a/pom.xml b/pom.xml
index 93eae48a..d383a4d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.github.liyiorg
weixin-popular
- 2.8.1-SNAPSHOT
+ 2.8.1
weixin-popular
The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.
@@ -94,14 +94,9 @@
com.vdurmont
emoji-java
- 3.1.1
-
-
- junit
- junit
- 4.12
- test
+ 3.1.3
+
@@ -147,7 +142,7 @@
utf-8
zh_CN
public
-
+ weixin.popular.bean.*
diff --git a/src/main/java/weixin/popular/api/CardAPI.java b/src/main/java/weixin/popular/api/CardAPI.java
index 5e9e9c0b..e4dfea70 100644
--- a/src/main/java/weixin/popular/api/CardAPI.java
+++ b/src/main/java/weixin/popular/api/CardAPI.java
@@ -68,6 +68,9 @@ public class CardAPI extends BaseAPI {
/**
* 批量查询卡券列表
+ * @param accessToken accessToken
+ * @param batchget batchget
+ * @return result
*/
public static BatchGetResult batchGet(String accessToken, BatchGet batchget) {
return batchGet(accessToken, JsonUtil.toJSONString(batchget));
@@ -75,6 +78,9 @@ public static BatchGetResult batchGet(String accessToken, BatchGet batchget) {
/**
* 批量查询卡券列表
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BatchGetResult batchGet(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -90,6 +96,9 @@ public static BatchGetResult batchGet(String accessToken, String postJson) {
/**
* 核查code
+ * @param accessToken accessToken
+ * @param codeCheck codeCheck
+ * @return result
*/
public static CodeCheckCodeResult codeCheckCode(String accessToken, CodeCheckCode codeCheck) {
return codeCheckCode(accessToken, JsonUtil.toJSONString(codeCheck));
@@ -97,6 +106,9 @@ public static CodeCheckCodeResult codeCheckCode(String accessToken, CodeCheckCod
/**
* 核查code
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeCheckCodeResult codeCheckCode(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -112,6 +124,9 @@ public static CodeCheckCodeResult codeCheckCode(String accessToken, String postJ
/**
* 核销Code
+ * @param accessToken accessToken
+ * @param codeConsume codeConsume
+ * @return result
*/
public static CodeDecryptResult codeConsume(String accessToken, CodeConsume codeConsume) {
return codeConsume(accessToken, JsonUtil.toJSONString(codeConsume));
@@ -119,6 +134,9 @@ public static CodeDecryptResult codeConsume(String accessToken, CodeConsume code
/**
* 核销Code
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeDecryptResult codeConsume(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -138,6 +156,9 @@ public static CodeDecryptResult codeConsume(String accessToken, String postJson)
* 2.开发者若从url上获取到加密code,请注意先进行urldecode,否则报错。
* 3.encrypt_code是卡券的code码经过加密处理得到的加密code码,与code一一对应。
* 4.开发者只能解密本公众号的加密code,否则报错。
+ * @param accessToken accessToken
+ * @param codeDecrypt codeDecrypt
+ * @return result
*/
public static CodeConsumeResult codeDecrypt(String accessToken, CodeDecrypt codeDecrypt) {
return codeDecrypt(accessToken, JsonUtil.toJSONString(codeDecrypt));
@@ -149,6 +170,9 @@ public static CodeConsumeResult codeDecrypt(String accessToken, CodeDecrypt code
* 2.开发者若从url上获取到加密code,请注意先进行urldecode,否则报错。
* 3.encrypt_code是卡券的code码经过加密处理得到的加密code码,与code一一对应。
* 4.开发者只能解密本公众号的加密code,否则报错。
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeConsumeResult codeDecrypt(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -164,6 +188,9 @@ public static CodeConsumeResult codeDecrypt(String accessToken, String postJson)
/**
* 导入code
+ * @param accessToken accessToken
+ * @param codeDeposit codeDeposit
+ * @return result
*/
public static CodeDepositResult codeDeposit(String accessToken, CodeDeposit codeDeposit) {
return codeDeposit(accessToken, JsonUtil.toJSONString(codeDeposit));
@@ -171,6 +198,9 @@ public static CodeDepositResult codeDeposit(String accessToken, CodeDeposit code
/**
* 导入code
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeDepositResult codeDeposit(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -186,6 +216,9 @@ public static CodeDepositResult codeDeposit(String accessToken, String postJson)
/**
* 查询Code
+ * @param accessToken accessToken
+ * @param codeGet codeGet
+ * @return result
*/
public static CodeGetResult codeGet(String accessToken, CodeGet codeGet) {
return codeGet(accessToken, JsonUtil.toJSONString(codeGet));
@@ -193,6 +226,9 @@ public static CodeGetResult codeGet(String accessToken, CodeGet codeGet) {
/**
* 查询Code
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeGetResult codeGet(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -208,6 +244,9 @@ public static CodeGetResult codeGet(String accessToken, String postJson) {
/**
* 查询导入code数目
+ * @param accessToken accessToken
+ * @param codeCount codeCount
+ * @return result
*/
public static CodeGetDepositCountResult codeGetDepositCount(String accessToken, CodeGetDepositCount codeCount) {
return codeGetDepositCount(accessToken,
@@ -216,6 +255,9 @@ public static CodeGetDepositCountResult codeGetDepositCount(String accessToken,
/**
* 查询导入code数目
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CodeGetDepositCountResult codeGetDepositCount( String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -231,6 +273,9 @@ public static CodeGetDepositCountResult codeGetDepositCount( String accessToken,
/**
* 设置卡券失效
+ * @param accessToken accessToken
+ * @param codeUnavailable codeUnavailable
+ * @return result
*/
public static BaseResult codeUnavailable(String accessToken, CodeUnavailable codeUnavailable) {
return codeUnavailable(accessToken,
@@ -239,6 +284,9 @@ public static BaseResult codeUnavailable(String accessToken, CodeUnavailable cod
/**
* 设置卡券失效
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult codeUnavailable(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -254,6 +302,9 @@ public static BaseResult codeUnavailable(String accessToken, String postJson) {
/**
* 设置卡券失效
+ * @param accessToken accessToken
+ * @param code code
+ * @return result
*/
public static BaseResult codeUnavailableByCode(String accessToken, String code) {
return codeUnavailable(accessToken, String.format("{\"code\": \"%s\"}", code));
@@ -261,6 +312,9 @@ public static BaseResult codeUnavailableByCode(String accessToken, String code)
/**
* 更改Code
+ * @param accessToken accessToken
+ * @param codeUpdate codeUpdate
+ * @return result
*/
public static BaseResult codeUpdate(String accessToken, CodeUpdate codeUpdate) {
return codeUpdate(accessToken, JsonUtil.toJSONString(codeUpdate));
@@ -268,6 +322,9 @@ public static BaseResult codeUpdate(String accessToken, CodeUpdate codeUpdate) {
/**
* 更改Code
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult codeUpdate(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -283,6 +340,9 @@ public static BaseResult codeUpdate(String accessToken, String postJson) {
/**
* 创建卡券
+ * @param accessToken accessToken
+ * @param card card
+ * @return result
*/
public static CreateResult create(String accessToken, Create> card) {
return create(accessToken, JsonUtil.toJSONString(card));
@@ -290,6 +350,9 @@ public static CreateResult create(String accessToken, Create> card) {
/**
* 创建代金券
+ * @param accessToken accessToken
+ * @param cashCard cashCard
+ * @return result
*/
public static CreateResult create(String accessToken, CashCard cashCard) {
Create card = new Create();
@@ -299,6 +362,9 @@ public static CreateResult create(String accessToken, CashCard cashCard) {
/**
* 创建折扣券
+ * @param accessToken accessToken
+ * @param discountCard discountCard
+ * @return result
*/
public static CreateResult create(String accessToken, DiscountCard discountCard) {
Create card = new Create();
@@ -308,6 +374,9 @@ public static CreateResult create(String accessToken, DiscountCard discountCard)
/**
* 创建优惠券
+ * @param accessToken accessToken
+ * @param generalCouponCard generalCouponCard
+ * @return result
*/
public static CreateResult create(String accessToken, GeneralCouponCard generalCouponCard) {
Create card = new Create();
@@ -317,6 +386,9 @@ public static CreateResult create(String accessToken, GeneralCouponCard generalC
/**
* 创建兑换券
+ * @param accessToken accessToken
+ * @param giftCard giftCard
+ * @return result
*/
public static CreateResult create(String accessToken, GiftCard giftCard) {
Create card = new Create();
@@ -326,6 +398,9 @@ public static CreateResult create(String accessToken, GiftCard giftCard) {
/**
* 创建团购券
+ * @param accessToken accessToken
+ * @param grouponCard grouponCard
+ * @return result
*/
public static CreateResult create(String accessToken, GrouponCard grouponCard) {
Create card = new Create();
@@ -335,8 +410,9 @@ public static CreateResult create(String accessToken, GrouponCard grouponCard) {
/**
* 创建卡券
- *
- * @return
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static CreateResult create(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -352,6 +428,9 @@ public static CreateResult create(String accessToken, String postJson) {
/**
* 删除卡券
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult delete(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -367,6 +446,9 @@ public static BaseResult delete(String accessToken, String postJson) {
/**
* 删除卡券
+ * @param accessToken accessToken
+ * @param cardId cardId
+ * @return result
*/
public static BaseResult deleteByCardId(String accessToken, String cardId) {
return delete(accessToken, String.format("{\"card_id\": \"%s\"}", cardId));
@@ -374,6 +456,9 @@ public static BaseResult deleteByCardId(String accessToken, String cardId) {
/**
* 查看卡券详情
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static GetResult> get(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -416,6 +501,9 @@ public static GetResult> get(String accessToken, String postJson) {
/**
* 查看卡券详情
+ * @param accessToken accessToken
+ * @param cardId cardId
+ * @return result
*/
public static GetResult> getByCardId(String accessToken, String cardId) {
return get(accessToken, String.format("{\"card_id\": \"%s\"}", cardId));
@@ -423,6 +511,9 @@ public static GetResult> getByCardId(String accessToken, String cardId) {
/**
* 创建货架
+ * @param accessToken accessToken
+ * @param landingPage landingPage
+ * @return result
*/
public static LandingPageCreateResult landingPageCreate(String accessToken, LandingPageCreate landingPage) {
return landingPageCreate(accessToken,
@@ -431,6 +522,9 @@ public static LandingPageCreateResult landingPageCreate(String accessToken, Land
/**
* 创建货架
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static LandingPageCreateResult landingPageCreate(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -446,6 +540,9 @@ public static LandingPageCreateResult landingPageCreate(String accessToken, Stri
/**
* 修改库存
+ * @param accessToken accessToken
+ * @param modifystock modifystock
+ * @return result
*/
public static BaseResult modifyStock(String accessToken, ModifyStock modifystock) {
return modifyStock(accessToken, JsonUtil.toJSONString(modifystock));
@@ -453,6 +550,9 @@ public static BaseResult modifyStock(String accessToken, ModifyStock modifystock
/**
* 修改库存
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult modifyStock(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -468,6 +568,9 @@ public static BaseResult modifyStock(String accessToken, String postJson) {
/**
* 图文消息群发卡券素材
+ * @param accessToken accessToken
+ * @param mpnews mpnews
+ * @return result
*/
public static MpNewsGetHtmlResult mpNewsGetHtml(String accessToken, MpNewsGetHtml mpnews) {
return mpNewsGetHtml(accessToken, JsonUtil.toJSONString(mpnews));
@@ -475,6 +578,9 @@ public static MpNewsGetHtmlResult mpNewsGetHtml(String accessToken, MpNewsGetHtm
/**
* 图文消息群发卡券素材
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static MpNewsGetHtmlResult mpNewsGetHtml(String accessToken,
String postJson) {
@@ -491,6 +597,9 @@ public static MpNewsGetHtmlResult mpNewsGetHtml(String accessToken,
/**
* 设置买单功能
+ * @param accessToken accessToken
+ * @param cardSet cardSet
+ * @return result
*/
public static BaseResult payCellSet(String accessToken, PaySellSet cardSet) {
return payCellSet(accessToken, JsonUtil.toJSONString(cardSet));
@@ -498,6 +607,9 @@ public static BaseResult payCellSet(String accessToken, PaySellSet cardSet) {
/**
* 设置买单功能
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult payCellSet(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -513,6 +625,9 @@ public static BaseResult payCellSet(String accessToken, String postJson) {
/**
* 设置扫描二维码领取单张卡券
+ * @param accessToken accessToken
+ * @param action action
+ * @return result
*/
public static QrCodeCreateResult qrcodeCreate(String accessToken,
QrCodeCreate action) {
@@ -521,6 +636,9 @@ public static QrCodeCreateResult qrcodeCreate(String accessToken,
/**
* 设置扫描二维码领取多张卡券
+ * @param accessToken accessToken
+ * @param action action
+ * @return result
*/
public static QrCodeCreateResult qrcodeCreate(String accessToken,
QrCodeCreateMultiple action) {
@@ -529,6 +647,9 @@ public static QrCodeCreateResult qrcodeCreate(String accessToken,
/**
* 创建领取卡券二维码
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static QrCodeCreateResult qrcodeCreate(String accessToken,
String postJson) {
@@ -545,6 +666,9 @@ public static QrCodeCreateResult qrcodeCreate(String accessToken,
/**
* 设置自助核销功能
+ * @param accessToken accessToken
+ * @param cardSet cardSet
+ * @return result
*/
public static BaseResult selfconsumecellSet(String accessToken,
PaySellSet cardSet) {
@@ -553,6 +677,9 @@ public static BaseResult selfconsumecellSet(String accessToken,
/**
* 设置自助核销功能
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult selfconsumecellSet(String accessToken,
String postJson) {
@@ -569,6 +696,9 @@ public static BaseResult selfconsumecellSet(String accessToken,
/**
* 设置测试白名单
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult testWhiteListSet(String accessToken,
String postJson) {
@@ -585,6 +715,9 @@ public static BaseResult testWhiteListSet(String accessToken,
/**
* 设置测试白名单
+ * @param accessToken accessToken
+ * @param whiteList whiteList
+ * @return result
*/
public static BaseResult testWhiteListSet(String accessToken,
TestWhiteListSet whiteList) {
@@ -593,6 +726,9 @@ public static BaseResult testWhiteListSet(String accessToken,
/**
* 更改卡券信息接口
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static UpdateResult update(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -608,6 +744,9 @@ public static UpdateResult update(String accessToken, String postJson) {
/**
* 更改卡券信息接口(代金券)
+ * @param accessToken accessToken
+ * @param updateCash updateCash
+ * @return result
*/
public static UpdateResult update(String accessToken, UpdateCash updateCash) {
return update(accessToken, JsonUtil.toJSONString(updateCash));
@@ -615,6 +754,9 @@ public static UpdateResult update(String accessToken, UpdateCash updateCash) {
/**
* 更改卡券信息接口(折扣券)
+ * @param accessToken accessToken
+ * @param updateDiscount updateDiscount
+ * @return result
*/
public static UpdateResult update(String accessToken,
UpdateDiscount updateDiscount) {
@@ -623,6 +765,9 @@ public static UpdateResult update(String accessToken,
/**
* 更改卡券信息接口(优惠券)
+ * @param accessToken accessToken
+ * @param updateGeneralCoupon updateGeneralCoupon
+ * @return result
*/
public static UpdateResult update(String accessToken,
UpdateGeneralCoupon updateGeneralCoupon) {
@@ -631,6 +776,9 @@ public static UpdateResult update(String accessToken,
/**
* 更改卡券信息接口(兑换券)
+ * @param accessToken accessToken
+ * @param updateGift updateGift
+ * @return result
*/
public static UpdateResult update(String accessToken, UpdateGift updateGift) {
return update(accessToken, JsonUtil.toJSONString(updateGift));
@@ -638,6 +786,9 @@ public static UpdateResult update(String accessToken, UpdateGift updateGift) {
/**
* 更改卡券信息接口(团购券)
+ * @param accessToken accessToken
+ * @param updateGroupon updateGroupon
+ * @return result
*/
public static UpdateResult update(String accessToken,
UpdateGroupon updateGroupon) {
@@ -646,6 +797,9 @@ public static UpdateResult update(String accessToken,
/**
* 获取用户已领取卡券
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static UserGetCardListResult userGetCardList(String accessToken,
String postJson) {
@@ -662,6 +816,9 @@ public static UserGetCardListResult userGetCardList(String accessToken,
/**
* 获取用户已领取卡券
+ * @param accessToken accessToken
+ * @param userGetCardList userGetCardList
+ * @return result
*/
public static UserGetCardListResult userGetCardList(String accessToken,
UserGetCardList userGetCardList) {
diff --git a/src/main/java/weixin/popular/api/DataCubeAPI.java b/src/main/java/weixin/popular/api/DataCubeAPI.java
index caafeeb6..34deb756 100644
--- a/src/main/java/weixin/popular/api/DataCubeAPI.java
+++ b/src/main/java/weixin/popular/api/DataCubeAPI.java
@@ -17,19 +17,18 @@
/**
* 数据统计
- * @author nobody
- *
+ * @author Moyq5
*/
public class DataCubeAPI extends BaseAPI {
/**
* 拉取卡券概况数据
- * 1. 查询时间区间需<=62天,否则报错;
+ * 1. 查询时间区间需<=62天,否则报错;
* 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
- * @param bizuinCube
- * @return
+ * @param access_token access_token
+ * @param bizuinCube bizuinCube
+ * @return result
*/
public static BizuinInfoResult getCardBizuinInfo(String access_token, BizuinInfo bizuinCube) {
return getCardBizuinInfo(access_token, JsonUtil.toJSONString(bizuinCube));
@@ -37,12 +36,12 @@ public static BizuinInfoResult getCardBizuinInfo(String access_token, BizuinInfo
/**
* 拉取卡券概况数据
- * 1. 查询时间区间需<=62天,否则报错;
+ * 1. 查询时间区间需<=62天,否则报错;
* 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
+ * @param access_token access_token
* @param requestJson post完整的json
- * @return
+ * @return result
*/
public static BizuinInfoResult getCardBizuinInfo(String access_token, String requestJson) {
HttpUriRequest httpUriRequest = RequestBuilder.post()
@@ -57,12 +56,12 @@ public static BizuinInfoResult getCardBizuinInfo(String access_token, String req
/**
* 获取免费券数据
* 1. 该接口目前仅支持拉取免费券(优惠券、团购券、折扣券、礼品券)的卡券相关数据,暂不支持特殊票券(电影票、会议门票、景区门票、飞机票)数据。
- * 2. 查询时间区间需<=62天,否则报错;
+ * 2. 查询时间区间需<=62天,否则报错;
* 3. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 4. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
- * @param freeCardCube
- * @return
+ * @param access_token access_token
+ * @param freeCardCube freeCardCube
+ * @return result
*/
public static CardInfoResult getCardCardInfo(String access_token, CardInfo freeCardCube) {
return getCardCardInfo(access_token, JsonUtil.toJSONString(freeCardCube));
@@ -71,12 +70,12 @@ public static CardInfoResult getCardCardInfo(String access_token, CardInfo freeC
/**
* 获取免费券数据
* 1. 该接口目前仅支持拉取免费券(优惠券、团购券、折扣券、礼品券)的卡券相关数据,暂不支持特殊票券(电影票、会议门票、景区门票、飞机票)数据。
- * 2. 查询时间区间需<=62天,否则报错;
+ * 2. 查询时间区间需<=62天,否则报错;
* 3. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 4. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
+ * @param access_token access_token
* @param requestJson post完整的json
- * @return
+ * @return result
*/
public static CardInfoResult getCardCardInfo(String access_token, String requestJson) {
HttpUriRequest httpUriRequest = RequestBuilder.post()
@@ -91,12 +90,12 @@ public static CardInfoResult getCardCardInfo(String access_token, String request
/**
* 拉取会员卡数据
- * 1. 查询时间区间需<=62天,否则报错;
+ * 1. 查询时间区间需<=62天,否则报错;
* 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
- * @param memberCardCube
- * @return
+ * @param access_token access_token
+ * @param memberCardCube memberCardCube
+ * @return result
*/
public static MemberCardInfoResult getCardMemberCardInfo(String access_token, MemberCardInfo memberCardCube) {
return getCardMemberCardInfo(access_token, JsonUtil.toJSONString(memberCardCube));
@@ -104,12 +103,12 @@ public static MemberCardInfoResult getCardMemberCardInfo(String access_token, Me
/**
* 拉取会员卡数据
- * 1. 查询时间区间需<=62天,否则报错;
+ * 1. 查询时间区间需<=62天,否则报错;
* 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;
* 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。
- * @param access_token
+ * @param access_token access_token
* @param requestJson post完整的json
- * @return
+ * @return result
*/
public static MemberCardInfoResult getCardMemberCardInfo(String access_token, String requestJson) {
HttpUriRequest httpUriRequest = RequestBuilder.post()
diff --git a/src/main/java/weixin/popular/api/MessageAPI.java b/src/main/java/weixin/popular/api/MessageAPI.java
index 5e640464..e1c10af8 100644
--- a/src/main/java/weixin/popular/api/MessageAPI.java
+++ b/src/main/java/weixin/popular/api/MessageAPI.java
@@ -81,9 +81,9 @@ public static Media mediaUploadnews(String access_token,List articles){
/**
* 高级群发 构成 MassMPnewsMessage 对象的前置请求接口
- * @param access_token
- * @param messageJson
- * @return
+ * @param access_token access_token
+ * @param messageJson messageJson
+ * @return result
*/
public static Media mediaUploadnews(String access_token,String messageJson){
HttpUriRequest httpUriRequest = RequestBuilder.post()
diff --git a/src/main/java/weixin/popular/api/PoiAPI.java b/src/main/java/weixin/popular/api/PoiAPI.java
index 3f274822..ad8a5bfd 100644
--- a/src/main/java/weixin/popular/api/PoiAPI.java
+++ b/src/main/java/weixin/popular/api/PoiAPI.java
@@ -24,6 +24,9 @@ public class PoiAPI extends BaseAPI {
/**
* 创建门店
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult addPoi(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -39,6 +42,9 @@ public static BaseResult addPoi(String accessToken, String postJson) {
/**
* 创建门店
+ * @param accessToken accessToken
+ * @param poi poi
+ * @return result
*/
public static BaseResult addPoi(String accessToken, Poi poi) {
return addPoi(accessToken, JsonUtil.toJSONString(poi));
@@ -46,6 +52,9 @@ public static BaseResult addPoi(String accessToken, Poi poi) {
/**
* 查询门店信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PoiResult getPoi(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -61,6 +70,9 @@ public static PoiResult getPoi(String accessToken, String postJson) {
/**
* 查询门店信息
+ * @param accessToken accessToken
+ * @param poi_id poi_id
+ * @return result
*/
public static PoiResult getPoiByPoiId(String accessToken, String poi_id) {
return getPoi(accessToken, String.format("{\"poi_id\": \"%s\"}", poi_id));
@@ -68,6 +80,9 @@ public static PoiResult getPoiByPoiId(String accessToken, String poi_id) {
/**
* 查询门店列表
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PoiListResult getPoiList(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -84,13 +99,10 @@ public static PoiListResult getPoiList(String accessToken, String postJson) {
/**
* 查询门店列表
*
- * @param accessToken
- * 令牌
- * @param begin
- * 开始位置,0 即为从第一条开始查询
- * @param limit
- * 返回数据条数,最大允许50,默认为20
- * @return
+ * @param accessToken 令牌
+ * @param begin 开始位置,0 即为从第一条开始查询
+ * @param limit 返回数据条数,最大允许50,默认为20
+ * @return result
*/
public static PoiListResult getPoiList(String accessToken, int begin, int limit) {
return getPoiList(accessToken, String.format("{\"begin\":%d, \"limit\": %d}", begin, limit));
@@ -98,6 +110,9 @@ public static PoiListResult getPoiList(String accessToken, int begin, int limit)
/**
* 修改门店服务信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult updatePoi(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -113,6 +128,9 @@ public static BaseResult updatePoi(String accessToken, String postJson) {
/**
* 修改门店服务信息
+ * @param accessToken accessToken
+ * @param poi poi
+ * @return result
*/
public static BaseResult updatePoi(String accessToken, Poi poi) {
return updatePoi(accessToken, JsonUtil.toJSONString(poi));
@@ -120,6 +138,9 @@ public static BaseResult updatePoi(String accessToken, Poi poi) {
/**
* 删除门店
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static BaseResult delPoi(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -140,7 +161,7 @@ public static BaseResult delPoi(String accessToken, String postJson) {
* 授权令牌
* @param poiId
* 门店ID
- * @return
+ * @return result
*/
public static BaseResult delPoiByPoiId(String accessToken, String poiId) {
return delPoi(accessToken, String.format("{\"poi_id\": \"%s\"}", poiId));
@@ -148,6 +169,8 @@ public static BaseResult delPoiByPoiId(String accessToken, String poiId) {
/**
* 获取门店类目表
+ * @param accessToken accessToken
+ * @return result
*/
public static CategoryListResult getWxCategory(String accessToken) {
HttpUriRequest httpUriRequest = RequestBuilder.post()
diff --git a/src/main/java/weixin/popular/api/ShakeAroundAPI.java b/src/main/java/weixin/popular/api/ShakeAroundAPI.java
index f75fce4e..8594fbf5 100644
--- a/src/main/java/weixin/popular/api/ShakeAroundAPI.java
+++ b/src/main/java/weixin/popular/api/ShakeAroundAPI.java
@@ -75,12 +75,14 @@
* 微信摇一摇周边
*
* @author Moyq5
- * @date 2016年7月31日
+ *
*/
public class ShakeAroundAPI extends BaseAPI {
/**
* 申请开通功能-查询审核状态
+ * @param accessToken accessToken
+ * @return result
*/
public static AccountAuditStatusResult accountAuditStatus(String accessToken) {
HttpUriRequest httpUriRequest = RequestBuilder.post()
@@ -93,6 +95,9 @@ public static AccountAuditStatusResult accountAuditStatus(String accessToken) {
/**
* 申请开通功能
+ * @param accessToken accessToken
+ * @param accountRegister accountRegister
+ * @return result
*/
public static AccountRegisterResult accountRegister(String accessToken,
AccountRegister accountRegister) {
@@ -102,6 +107,9 @@ public static AccountRegisterResult accountRegister(String accessToken,
/**
* 申请开通功能
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static AccountRegisterResult accountRegister(String accessToken,
String postJson) {
@@ -118,6 +126,9 @@ public static AccountRegisterResult accountRegister(String accessToken,
/**
* 设备管理-申请设备ID
+ * @param accessToken accessToken
+ * @param deviceApplyId deviceApplyId
+ * @return result
*/
public static DeviceApplyIdResult deviceApplyId(String accessToken,
DeviceApplyId deviceApplyId) {
@@ -126,6 +137,9 @@ public static DeviceApplyIdResult deviceApplyId(String accessToken,
/**
* 设备管理-申请设备ID
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceApplyIdResult deviceApplyId(String accessToken,
String postJson) {
@@ -142,6 +156,9 @@ public static DeviceApplyIdResult deviceApplyId(String accessToken,
/**
* 设备管理-查询设备ID申请审核状态
+ * @param accessToken accessToken
+ * @param deviceApplyStatus deviceApplyStatus
+ * @return result
*/
public static DeviceApplyStatusResult deviceApplyStatus(String accessToken,
DeviceApplyStatus deviceApplyStatus) {
@@ -151,6 +168,9 @@ public static DeviceApplyStatusResult deviceApplyStatus(String accessToken,
/**
* 设备管理-查询设备ID申请审核状态
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceApplyStatusResult deviceApplyStatus(String accessToken,
String postJson) {
@@ -167,6 +187,9 @@ public static DeviceApplyStatusResult deviceApplyStatus(String accessToken,
/**
* 设备管理-配置设备与(或者其它公众号的)门店的关联关系
+ * @param accessToken accessToken
+ * @param deviceBindLocation deviceBindLocation
+ * @return result
*/
public static DeviceBindLocationResult deviceBindLocation(
String accessToken, DeviceBindLocation deviceBindLocation) {
@@ -176,6 +199,9 @@ public static DeviceBindLocationResult deviceBindLocation(
/**
* 设备管理-配置设备与(或者其它公众号的)门店的关联关系
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceBindLocationResult deviceBindLocation(
String accessToken, String postJson) {
@@ -192,6 +218,9 @@ public static DeviceBindLocationResult deviceBindLocation(
/**
* 配置设备与页面的关联关系
+ * @param accessToken accessToken
+ * @param deviceBindPage deviceBindPage
+ * @return result
*/
public static DeviceBindPageResult deviceBindPage(String accessToken,
DeviceBindPage deviceBindPage) {
@@ -201,6 +230,9 @@ public static DeviceBindPageResult deviceBindPage(String accessToken,
/**
* 配置设备与页面的关联关系
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceBindPageResult deviceBindPage(String accessToken,
String postJson) {
@@ -217,6 +249,9 @@ public static DeviceBindPageResult deviceBindPage(String accessToken,
/**
* 新增分组
+ * @param accessToken accessToken
+ * @param deviceGroupAdd deviceGroupAdd
+ * @return result
*/
public static DeviceGroupAddResult deviceGroupAdd(String accessToken,
DeviceGroupAdd deviceGroupAdd) {
@@ -226,6 +261,9 @@ public static DeviceGroupAddResult deviceGroupAdd(String accessToken,
/**
* 新增分组
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupAddResult deviceGroupAdd(String accessToken,
String postJson) {
@@ -242,6 +280,9 @@ public static DeviceGroupAddResult deviceGroupAdd(String accessToken,
/**
* 添加设备到分组
+ * @param accessToken accessToken
+ * @param deviceGroupAddDevice deviceGroupAddDevice
+ * @return result
*/
public static DeviceGroupAddDeviceResult deviceGroupAddDevice(
String accessToken, DeviceGroupAddDevice deviceGroupAddDevice) {
@@ -251,6 +292,9 @@ public static DeviceGroupAddDeviceResult deviceGroupAddDevice(
/**
* 添加设备到分组
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupAddDeviceResult deviceGroupAddDevice(
String accessToken, String postJson) {
@@ -267,6 +311,9 @@ public static DeviceGroupAddDeviceResult deviceGroupAddDevice(
/**
* 删除分组
+ * @param accessToken accessToken
+ * @param deviceGroupDelete deviceGroupDelete
+ * @return result
*/
public static DeviceGroupDeleteResult deviceGroupDelete(String accessToken,
DeviceGroupDelete deviceGroupDelete) {
@@ -276,6 +323,9 @@ public static DeviceGroupDeleteResult deviceGroupDelete(String accessToken,
/**
* 删除分组
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupDeleteResult deviceGroupDelete(String accessToken,
String postJson) {
@@ -292,6 +342,9 @@ public static DeviceGroupDeleteResult deviceGroupDelete(String accessToken,
/**
* 从分组中移除设备
+ * @param accessToken accessToken
+ * @param deviceGroupDeleteDevice deviceGroupDeleteDevice
+ * @return result
*/
public static DeviceGroupDeleteDeviceResult deviceGroupDeleteDevice(
String accessToken, DeviceGroupDeleteDevice deviceGroupDeleteDevice) {
@@ -301,6 +354,9 @@ public static DeviceGroupDeleteDeviceResult deviceGroupDeleteDevice(
/**
* 从分组中移除设备
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupDeleteDeviceResult deviceGroupDeleteDevice(
String accessToken, String postJson) {
@@ -317,6 +373,9 @@ public static DeviceGroupDeleteDeviceResult deviceGroupDeleteDevice(
/**
* 查询分组详情
+ * @param accessToken accessToken
+ * @param deviceGroupGetDetail deviceGroupGetDetail
+ * @return result
*/
public static DeviceGroupGetDetailResult deviceGroupGetDetail(
String accessToken, DeviceGroupGetDetail deviceGroupGetDetail) {
@@ -326,6 +385,9 @@ public static DeviceGroupGetDetailResult deviceGroupGetDetail(
/**
* 查询分组详情
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupGetDetailResult deviceGroupGetDetail(
String accessToken, String postJson) {
@@ -342,6 +404,9 @@ public static DeviceGroupGetDetailResult deviceGroupGetDetail(
/**
* 查询分组列表
+ * @param accessToken accessToken
+ * @param deviceGroupGetList deviceGroupGetList
+ * @return result
*/
public static DeviceGroupGetListResult deviceGroupGetList(
String accessToken, DeviceGroupGetList deviceGroupGetList) {
@@ -351,6 +416,9 @@ public static DeviceGroupGetListResult deviceGroupGetList(
/**
* 查询分组列表
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupGetListResult deviceGroupGetList(
String accessToken, String postJson) {
@@ -367,6 +435,9 @@ public static DeviceGroupGetListResult deviceGroupGetList(
/**
* 编辑分组信息
+ * @param accessToken accessToken
+ * @param deviceGroupUpdate deviceGroupUpdate
+ * @return result
*/
public static DeviceGroupUpdateResult deviceGroupUpdate(String accessToken,
DeviceGroupUpdate deviceGroupUpdate) {
@@ -376,6 +447,9 @@ public static DeviceGroupUpdateResult deviceGroupUpdate(String accessToken,
/**
* 编辑分组信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceGroupUpdateResult deviceGroupUpdate(String accessToken,
String postJson) {
@@ -392,6 +466,9 @@ public static DeviceGroupUpdateResult deviceGroupUpdate(String accessToken,
/**
* 查询设备列表
+ * @param accessToken accessToken
+ * @param deviceSearch deviceSearch
+ * @return result
*/
public static DeviceSearchResult deviceSearch(String accessToken,
DeviceSearch deviceSearch) {
@@ -400,6 +477,9 @@ public static DeviceSearchResult deviceSearch(String accessToken,
/**
* 查询设备列表
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceSearchResult deviceSearch(String accessToken,
String postJson) {
@@ -416,6 +496,9 @@ public static DeviceSearchResult deviceSearch(String accessToken,
/**
* 编辑设备信息
+ * @param accessToken accessToken
+ * @param deviceUpdate deviceUpdate
+ * @return result
*/
public static DeviceUpdateResult deviceUpdate(String accessToken,
DeviceUpdate deviceUpdate) {
@@ -424,6 +507,9 @@ public static DeviceUpdateResult deviceUpdate(String accessToken,
/**
* 编辑设备信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static DeviceUpdateResult deviceUpdate(String accessToken,
String postJson) {
@@ -440,6 +526,9 @@ public static DeviceUpdateResult deviceUpdate(String accessToken,
/**
* 摇一摇红包-创建红包活动
+ * @param accessToken accessToken
+ * @param lotteryAddLotteryInfo lotteryAddLotteryInfo
+ * @return result
*/
public static LotteryAddLotteryInfoResult lotteryAddLotteryInfo(
String accessToken, LotteryAddLotteryInfo lotteryAddLotteryInfo) {
@@ -449,6 +538,9 @@ public static LotteryAddLotteryInfoResult lotteryAddLotteryInfo(
/**
* 摇一摇红包-创建红包活动
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static LotteryAddLotteryInfoResult lotteryAddLotteryInfo(
String accessToken, String postJson) {
@@ -465,6 +557,9 @@ public static LotteryAddLotteryInfoResult lotteryAddLotteryInfo(
/**
* 摇一摇红包-红包查询接口
+ * @param accessToken accessToken
+ * @param lotteryId lotteryId
+ * @return result
*/
public static LotteryQueryLotteryResult lotteryQueryLottery(
String accessToken, String lotteryId) {
@@ -479,6 +574,10 @@ public static LotteryQueryLotteryResult lotteryQueryLottery(
/**
* 摇一摇红包-设置红包活动抽奖开关
+ * @param accessToken accessToken
+ * @param lotteryId lotteryId
+ * @param onoff onoff
+ * @return result
*/
public static BaseResult lotterySetLotterySwitch(String accessToken,
String lotteryId, int onoff) {
@@ -494,6 +593,9 @@ public static BaseResult lotterySetLotterySwitch(String accessToken,
/**
* 摇一摇红包-录入红包信息
+ * @param accessToken accessToken
+ * @param lotterySetPrizeBucket lotterySetPrizeBucket
+ * @return result
*/
public static LotterySetPrizeBucketResult lotterySetPrizeBucket(
String accessToken, LotterySetPrizeBucket lotterySetPrizeBucket) {
@@ -503,6 +605,9 @@ public static LotterySetPrizeBucketResult lotterySetPrizeBucket(
/**
* 摇一摇红包-录入红包信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static LotterySetPrizeBucketResult lotterySetPrizeBucket(
String accessToken, String postJson) {
@@ -519,6 +624,10 @@ public static LotterySetPrizeBucketResult lotterySetPrizeBucket(
/**
* 上传图片素材
+ * @param accessToken accessToken
+ * @param type type
+ * @param media media
+ * @return result
*/
public static MaterialAddResult materialAdd(String accessToken,
MediaType type, File media) {
@@ -536,6 +645,9 @@ public static MaterialAddResult materialAdd(String accessToken,
/**
* 页面管理-新增页面
+ * @param accessToken accessToken
+ * @param pageAdd pageAdd
+ * @return result
*/
public static PageAddResult pageAdd(String accessToken, PageAdd pageAdd) {
return pageAdd(accessToken, JsonUtil.toJSONString(pageAdd));
@@ -543,6 +655,9 @@ public static PageAddResult pageAdd(String accessToken, PageAdd pageAdd) {
/**
* 页面管理-新增页面
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PageAddResult pageAdd(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
@@ -558,6 +673,9 @@ public static PageAddResult pageAdd(String accessToken, String postJson) {
/**
* 页面管理-删除页面
+ * @param accessToken accessToken
+ * @param pageDelete pageDelete
+ * @return result
*/
public static PageDeleteResult pageDelete(String accessToken,
PageDelete pageDelete) {
@@ -566,6 +684,9 @@ public static PageDeleteResult pageDelete(String accessToken,
/**
* 页面管理-删除页面
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PageDeleteResult pageDelete(String accessToken,
String postJson) {
@@ -582,6 +703,9 @@ public static PageDeleteResult pageDelete(String accessToken,
/**
* 页面管理-查询页面列表
+ * @param accessToken accessToken
+ * @param pageSearch pageSearch
+ * @return result
*/
public static PageSearchResult pageSearch(String accessToken,
PageSearch pageSearch) {
@@ -590,6 +714,9 @@ public static PageSearchResult pageSearch(String accessToken,
/**
* 页面管理-查询页面列表
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PageSearchResult pageSearch(String accessToken,
String postJson) {
@@ -606,6 +733,9 @@ public static PageSearchResult pageSearch(String accessToken,
/**
* 页面管理-编辑页面信息
+ * @param accessToken accessToken
+ * @param pageUpdate pageUpdate
+ * @return result
*/
public static PageUpdateResult pageUpdate(String accessToken,
PageUpdate pageUpdate) {
@@ -614,6 +744,9 @@ public static PageUpdateResult pageUpdate(String accessToken,
/**
* 页面管理-编辑页面信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static PageUpdateResult pageUpdate(String accessToken,
String postJson) {
@@ -630,6 +763,9 @@ public static PageUpdateResult pageUpdate(String accessToken,
/**
* 查询设备与页面的关联关系
+ * @param accessToken accessToken
+ * @param relationSearch relationSearch
+ * @return result
*/
public static RelationSearchResult relationSearch(String accessToken,
RelationSearch relationSearch) {
@@ -639,6 +775,9 @@ public static RelationSearchResult relationSearch(String accessToken,
/**
* 查询设备与页面的关联关系
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static RelationSearchResult relationSearch(String accessToken,
String postJson) {
@@ -655,6 +794,9 @@ public static RelationSearchResult relationSearch(String accessToken,
/**
* 以设备为维度的数据统计接口
+ * @param accessToken accessToken
+ * @param statisticsDevice statisticsDevice
+ * @return result
*/
public static StatisticsDeviceResult statisticsDevice(String accessToken,
StatisticsDevice statisticsDevice) {
@@ -664,6 +806,9 @@ public static StatisticsDeviceResult statisticsDevice(String accessToken,
/**
* 以设备为维度的数据统计接口
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static StatisticsDeviceResult statisticsDevice(String accessToken,
String postJson) {
@@ -680,6 +825,9 @@ public static StatisticsDeviceResult statisticsDevice(String accessToken,
/**
* 批量查询设备统计数据接口
+ * @param accessToken accessToken
+ * @param statisticsDeviceList statisticsDeviceList
+ * @return result
*/
public static StatisticsDeviceListResult statisticsDeviceList(
String accessToken, StatisticsDeviceList statisticsDeviceList) {
@@ -689,6 +837,9 @@ public static StatisticsDeviceListResult statisticsDeviceList(
/**
* 批量查询设备统计数据接口
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static StatisticsDeviceListResult statisticsDeviceList(
String accessToken, String postJson) {
@@ -705,6 +856,9 @@ public static StatisticsDeviceListResult statisticsDeviceList(
/**
* 以页面为维度的数据统计接口
+ * @param accessToken accessToken
+ * @param statisticsPage statisticsPage
+ * @return result
*/
public static StatisticsPageResult statisticsPage(String accessToken,
StatisticsPage statisticsPage) {
@@ -714,6 +868,9 @@ public static StatisticsPageResult statisticsPage(String accessToken,
/**
* 以页面为维度的数据统计接口
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static StatisticsPageResult statisticsPage(String accessToken,
String postJson) {
@@ -730,6 +887,9 @@ public static StatisticsPageResult statisticsPage(String accessToken,
/**
* 批量查询页面统计数据接口
+ * @param accessToken accessToken
+ * @param statisticsPageList statisticsPageList
+ * @return result
*/
public static StatisticsPageListResult statisticsPageList(
String accessToken, StatisticsPageList statisticsPageList) {
@@ -739,6 +899,9 @@ public static StatisticsPageListResult statisticsPageList(
/**
* 批量查询页面统计数据接口
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static StatisticsPageListResult statisticsPageList(
String accessToken, String postJson) {
@@ -755,6 +918,9 @@ public static StatisticsPageListResult statisticsPageList(
/**
* 获取设备及用户信息
+ * @param accessToken accessToken
+ * @param postJson postJson
+ * @return result
*/
public static UserGetShakeInfoResult userGetShakeInfo(String accessToken,
String postJson) {
@@ -771,6 +937,9 @@ public static UserGetShakeInfoResult userGetShakeInfo(String accessToken,
/**
* 获取设备及用户信息
+ * @param accessToken accessToken
+ * @param userGetShakeInfo userGetShakeInfo
+ * @return result
*/
public static UserGetShakeInfoResult userGetShakeInfo(String accessToken,
UserGetShakeInfo userGetShakeInfo) {
diff --git a/src/main/java/weixin/popular/api/SnsAPI.java b/src/main/java/weixin/popular/api/SnsAPI.java
index cb97a470..8342885b 100644
--- a/src/main/java/weixin/popular/api/SnsAPI.java
+++ b/src/main/java/weixin/popular/api/SnsAPI.java
@@ -6,6 +6,7 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
+import weixin.popular.bean.BaseResult;
import weixin.popular.bean.sns.SnsToken;
import weixin.popular.bean.user.User;
import weixin.popular.client.LocalHttpClient;
@@ -92,6 +93,24 @@ public static SnsToken oauth2ComponentRefreshToken(String appid,String refresh_t
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,SnsToken.class);
}
+
+
+ /**
+ * 检验授权凭证(access_token)是否有效
+ * @since 2.8.1
+ * @param access_token access_token
+ * @param openid openid
+ * @return result
+ */
+ public static BaseResult auth(String access_token,String openid){
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
+ .setUri(BASE_URI + "/sns/auth")
+ .addParameter(getATPN(), access_token)
+ .addParameter("openid", openid)
+ .build();
+ return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
+ }
+
/**
* 拉取用户信息(需scope为 snsapi_userinfo)
@@ -109,7 +128,7 @@ public static SnsToken oauth2ComponentRefreshToken(String appid,String refresh_t
* @return User
*/
public static User userinfo(String access_token,String openid,String lang,int emoji){
- HttpUriRequest httpUriRequest = RequestBuilder.post()
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/sns/userinfo")
.addParameter(PARAM_ACCESS_TOKEN, access_token)
.addParameter("openid", openid)
diff --git a/src/main/java/weixin/popular/api/TicketAPI.java b/src/main/java/weixin/popular/api/TicketAPI.java
index 5c43ca5f..1880ae2a 100644
--- a/src/main/java/weixin/popular/api/TicketAPI.java
+++ b/src/main/java/weixin/popular/api/TicketAPI.java
@@ -12,17 +12,27 @@
*
*/
public class TicketAPI extends BaseAPI{
-
+
/**
* 获取 jsapi_ticket
* @param access_token access_token
- * @return Ticket
+ * @return ticket
*/
public static Ticket ticketGetticket(String access_token){
- HttpUriRequest httpUriRequest = RequestBuilder.post()
+ return ticketGetticket(access_token,"jsapi");
+ }
+
+ /**
+ * 获取 ticket
+ * @param access_token access_token
+ * @param type jsapi or wx_card
+ * @return ticket
+ */
+ public static Ticket ticketGetticket(String access_token,String type){
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/cgi-bin/ticket/getticket")
- .addParameter(PARAM_ACCESS_TOKEN,access_token)
- .addParameter("type", "jsapi")
+ .addParameter(getATPN(),access_token)
+ .addParameter("type", type)
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,Ticket.class);
}
diff --git a/src/main/java/weixin/popular/api/TokenAPI.java b/src/main/java/weixin/popular/api/TokenAPI.java
index 7bf4d22c..17124bb8 100644
--- a/src/main/java/weixin/popular/api/TokenAPI.java
+++ b/src/main/java/weixin/popular/api/TokenAPI.java
@@ -20,7 +20,7 @@ public class TokenAPI extends BaseAPI{
* @return Token
*/
public static Token token(String appid,String secret){
- HttpUriRequest httpUriRequest = RequestBuilder.post()
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/cgi-bin/token")
.addParameter("grant_type","client_credential")
.addParameter("appid", appid)
diff --git a/src/main/java/weixin/popular/api/UserAPI.java b/src/main/java/weixin/popular/api/UserAPI.java
index b61dff18..def3e28e 100644
--- a/src/main/java/weixin/popular/api/UserAPI.java
+++ b/src/main/java/weixin/popular/api/UserAPI.java
@@ -43,7 +43,7 @@ public class UserAPI extends BaseAPI{
* @return User
*/
public static User userInfo(String access_token,String openid,int emoji){
- HttpUriRequest httpUriRequest = RequestBuilder.post()
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI+"/cgi-bin/user/info")
.addParameter(getATPN(),access_token)
.addParameter("openid",openid)
@@ -73,7 +73,7 @@ public static User userInfo(String access_token,String openid){
* @return FollowResult
*/
public static FollowResult userGet(String access_token,String next_openid){
- HttpUriRequest httpUriRequest = RequestBuilder.post()
+ HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI+"/cgi-bin/user/get")
.addParameter(getATPN(),access_token)
.addParameter("next_openid", next_openid==null?"":next_openid)
@@ -474,4 +474,5 @@ public BaseResult tagsMembersBatchunblacklist(String access_token,String[] openi
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
}
+
}
diff --git a/src/main/java/weixin/popular/client/HttpClientFactory.java b/src/main/java/weixin/popular/client/HttpClientFactory.java
index 63e902c6..d4fea7ad 100644
--- a/src/main/java/weixin/popular/client/HttpClientFactory.java
+++ b/src/main/java/weixin/popular/client/HttpClientFactory.java
@@ -44,7 +44,7 @@ public static CloseableHttpClient createHttpClient() {
* @param maxPerRoute maxPerRoute
* @param timeout timeout
* @param retryExecutionCount retryExecutionCount
- * @return
+ * @return CloseableHttpClient
*/
public static CloseableHttpClient createHttpClient(int maxTotal,int maxPerRoute,int timeout,int retryExecutionCount) {
try {
diff --git a/src/main/java/weixin/popular/support/token/AuthorizerManager.java b/src/main/java/weixin/popular/support/token/AuthorizerManager.java
deleted file mode 100644
index 7ce09761..00000000
--- a/src/main/java/weixin/popular/support/token/AuthorizerManager.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package weixin.popular.support.token;
-
-
-/**
- * 公众号授权令牌管理类
- *
- * @author Moyq5
- *
- */
-public class AuthorizerManager extends AuthorizerManagerAbstract {
-
- private static AuthorizerManagerAbstract manager;
-
- static {
- TokenContext context = new TokenContext();
- context.setRefreshScheduler(AuthorizerRefreshScheduler.getInstance());
- context.setTokenStorage(new DefaultAuthorizerStorage());
- context.setType(TokenType.AUTHORIZER);
- context.setRefreshMsgHandler(new RefreshMsgHandler());
- manager = new AuthorizerManager(context);
- }
-
- private AuthorizerManager(TokenContext context) {
- super(context);
- }
-
- /**
- * 获取实例对象
- *
- * @return
- */
- public static AuthorizerManagerAbstract getInstance() {
- return manager;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/AuthorizerManagerAbstract.java b/src/main/java/weixin/popular/support/token/AuthorizerManagerAbstract.java
deleted file mode 100644
index eb521bbf..00000000
--- a/src/main/java/weixin/popular/support/token/AuthorizerManagerAbstract.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 公众号授权令牌管理类
- *
- * @author Moyq5
- *
- */
-public abstract class AuthorizerManagerAbstract extends TokenManager {
-
- protected AuthorizerManagerAbstract(TokenContext context) {
- super(context);
- }
-
- /**
- * 获取公众号授权令牌
- * @param componentAppId 第三方平台应用AppId
- * @param authorizeAppId 公众号AppId
- * @return
- */
- public String getAccessToken(String componentAppId, String authorizeAppId) {
- return context.getTokenStorage().getAccessToken(TokenType.AUTHORIZER, componentAppId, authorizeAppId, null);
- }
-
-
-}
diff --git a/src/main/java/weixin/popular/support/token/AuthorizerRefreshInfo.java b/src/main/java/weixin/popular/support/token/AuthorizerRefreshInfo.java
deleted file mode 100644
index 1550a338..00000000
--- a/src/main/java/weixin/popular/support/token/AuthorizerRefreshInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package weixin.popular.support.token;
-
-import java.io.Serializable;
-
-/**
- * 公众号授权令牌的刷新信息
- *
- * @author Moyq5
- *
- */
-public class AuthorizerRefreshInfo implements RefreshInfo, Serializable {
-
- private static final long serialVersionUID = 1L;
- private String componentAppId;
- private String componentAccessToken;
- private String authorizerAppId;
- private String authorizerRefreshToken;
-
- public String getComponentAppId() {
- return componentAppId;
- }
-
- public void setComponentAppId(String componentAppId) {
- this.componentAppId = componentAppId;
- }
-
- public String getComponentAccessToken() {
- return componentAccessToken;
- }
-
- public void setComponentAccessToken(String componentAccessToken) {
- this.componentAccessToken = componentAccessToken;
- }
-
- public String getAuthorizerAppId() {
- return authorizerAppId;
- }
-
- public void setAuthorizerAppId(String authorizerAppId) {
- this.authorizerAppId = authorizerAppId;
- }
-
- public String getAuthorizerRefreshToken() {
- return authorizerRefreshToken;
- }
-
- public void setAuthorizerRefreshToken(String authorizerRefreshToken) {
- this.authorizerRefreshToken = authorizerRefreshToken;
- }
-}
diff --git a/src/main/java/weixin/popular/support/token/AuthorizerRefreshScheduler.java b/src/main/java/weixin/popular/support/token/AuthorizerRefreshScheduler.java
deleted file mode 100644
index 3a4c8f6b..00000000
--- a/src/main/java/weixin/popular/support/token/AuthorizerRefreshScheduler.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package weixin.popular.support.token;
-
-import weixin.popular.api.ComponentAPI;
-import weixin.popular.bean.component.AuthorizerAccessToken;
-
-/**
- * 第三方平台authorizer_access_token刷新类
- *
- * @author Moyq5
- *
- */
-public class AuthorizerRefreshScheduler extends RefreshSchedulerAbstract {
-
- private static AuthorizerRefreshScheduler instance = new AuthorizerRefreshScheduler();
-
- private AuthorizerRefreshScheduler() {
- }
-
- /**
- * 获取实例对象
- *
- * @return
- */
- public static AuthorizerRefreshScheduler getInstance() {
- return instance;
- }
-
- /**
- * 刷新并返回新授权令牌
- */
- @Override
- protected AuthorizerTokenInfo execute(AuthorizerRefreshInfo ari) {
- AuthorizerAccessToken aat = ComponentAPI.api_authorizer_token(
- ari.getComponentAccessToken(), ari.getComponentAppId(),
- ari.getAuthorizerAppId(), ari.getAuthorizerRefreshToken());
-
- if (!aat.isSuccess()) {
- AuthorizerManager.getInstance().getContext().getRefreshMsgHandler().handle(ari.getAuthorizerAppId(), aat.getErrcode(), aat.getErrmsg());
- return null;
- }
-
- AuthorizerTokenInfo ati = new AuthorizerTokenInfo();
- ati.setAppId(ari.getAuthorizerAppId());
- ati.setRefreshToken(aat.getAuthorizer_refresh_token());
- ati.setComponentAppId(ari.getComponentAppId());
- ati.setExpiresIn(aat.isSuccess() ? aat.getExpires_in():0);
- ati.setAccessToken(aat.getAuthorizer_access_token());
- ati.setType(TokenType.AUTHORIZER);
- return ati;
- }
-
- @Override
- protected TokenStorage getTokenStorage() {
- return AuthorizerManager.getInstance().getContext().getTokenStorage();
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/AuthorizerTokenInfo.java b/src/main/java/weixin/popular/support/token/AuthorizerTokenInfo.java
deleted file mode 100644
index b5e9d556..00000000
--- a/src/main/java/weixin/popular/support/token/AuthorizerTokenInfo.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package weixin.popular.support.token;
-
-import java.io.Serializable;
-
-/**
- * 第三方平台公众号授权令牌信息
- *
- * @author Moyq5
- *
- */
-public class AuthorizerTokenInfo extends TokenInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private String componentAppId;
- private String refreshToken;
-
- public String getComponentAppId() {
- return componentAppId;
- }
-
- public void setComponentAppId(String componentAppId) {
- this.componentAppId = componentAppId;
- }
-
- public String getRefreshToken() {
- return refreshToken;
- }
-
- public void setRefreshToken(String refreshToken) {
- this.refreshToken = refreshToken;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/ComponentManager.java b/src/main/java/weixin/popular/support/token/ComponentManager.java
deleted file mode 100644
index dd8e727f..00000000
--- a/src/main/java/weixin/popular/support/token/ComponentManager.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package weixin.popular.support.token;
-
-
-/**
- * 第三方平台授权令牌管理类
- *
- * @author Moyq5
- *
- */
-public class ComponentManager extends ComponentManagerAbstract {
-
- private static ComponentManagerAbstract manager;
-
- static {
- TokenContext context = new TokenContext();
- context.setRefreshScheduler(ComponentRefreshScheduler.getInstance());
- context.setTokenStorage(new DefaultComponentStorage());
- context.setType(TokenType.COMPONENT);
- context.setRefreshMsgHandler(new RefreshMsgHandler());
- manager = new ComponentManager(context);
- }
-
- private ComponentManager(TokenContext context) {
- super(context);
- }
-
- /**
- * 获取实例对象
- *
- * @return
- */
- public synchronized static ComponentManagerAbstract getInstance() {
- return manager;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/ComponentManagerAbstract.java b/src/main/java/weixin/popular/support/token/ComponentManagerAbstract.java
deleted file mode 100644
index 4b7da709..00000000
--- a/src/main/java/weixin/popular/support/token/ComponentManagerAbstract.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 第三方平台应用授权令牌管理类
- *
- * @author Moyq5
- *
- */
-public abstract class ComponentManagerAbstract extends TokenManager {
-
- protected ComponentManagerAbstract(TokenContext context) {
- super(context);
- }
-
- /**
- * 第三方平台应用授权令牌
- * @param componentAppId 第三方平台应用AppId
- * @return
- */
- public String getAccessToken(String componentAppId) {
- return context.getTokenStorage().getAccessToken(TokenType.COMPONENT, componentAppId, null, null);
- }
-}
diff --git a/src/main/java/weixin/popular/support/token/ComponentRefreshInfo.java b/src/main/java/weixin/popular/support/token/ComponentRefreshInfo.java
deleted file mode 100644
index 2d8abbc0..00000000
--- a/src/main/java/weixin/popular/support/token/ComponentRefreshInfo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package weixin.popular.support.token;
-
-import java.io.Serializable;
-
-/**
- * 第三方平台授权令牌的刷新信息
- *
- * @author Moyq5
- *
- */
-public class ComponentRefreshInfo implements RefreshInfo, Serializable {
-
- private static final long serialVersionUID = 1L;
- private String appId;
- private String appSecret;
- private String verifyTicket;
-
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public String getAppSecret() {
- return appSecret;
- }
-
- public void setAppSecret(String appSecret) {
- this.appSecret = appSecret;
- }
-
- public String getVerifyTicket() {
- return verifyTicket;
- }
-
- public void setVerifyTicket(String verifyTicket) {
- this.verifyTicket = verifyTicket;
- }
-}
diff --git a/src/main/java/weixin/popular/support/token/ComponentRefreshScheduler.java b/src/main/java/weixin/popular/support/token/ComponentRefreshScheduler.java
deleted file mode 100644
index a58b3576..00000000
--- a/src/main/java/weixin/popular/support/token/ComponentRefreshScheduler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package weixin.popular.support.token;
-
-import weixin.popular.api.ComponentAPI;
-import weixin.popular.bean.component.ComponentAccessToken;
-
-/**
- * 第三方平台component_access_token刷新类
- *
- * @author Moyq5
- *
- */
-public class ComponentRefreshScheduler extends RefreshSchedulerAbstract {
-
- private static ComponentRefreshScheduler instance = new ComponentRefreshScheduler();
-
- private ComponentRefreshScheduler() {
- }
-
- /**
- * 获取实例对象
- *
- * @return
- */
- public static ComponentRefreshScheduler getInstance() {
- return instance;
- }
-
- /**
- * 刷新并返回新授权令牌
- */
- @Override
- public ComponentTokenInfo execute(ComponentRefreshInfo cri) {
- ComponentAccessToken cat = ComponentAPI.api_component_token(
- cri.getAppId(), cri.getAppSecret(), cri.getVerifyTicket());
-
- if (!cat.isSuccess()) {
- ComponentManager.getInstance().getContext().getRefreshMsgHandler().handle(cri.getAppId(), cat.getErrcode(), cat.getErrmsg());
- return null;
- }
-
- ComponentTokenInfo cti = new ComponentTokenInfo();
- cti.setAccessToken(cat.getComponent_access_token());
- cti.setAppId(cri.getAppId());
- cti.setExpiresIn(cat.isSuccess() ? cat.getExpires_in():0);
- cti.setType(TokenType.COMPONENT);
- return cti;
- }
-
- @Override
- protected TokenStorage getTokenStorage() {
- return ComponentManager.getInstance().getContext().getTokenStorage();
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/ComponentTokenInfo.java b/src/main/java/weixin/popular/support/token/ComponentTokenInfo.java
deleted file mode 100644
index 78135c15..00000000
--- a/src/main/java/weixin/popular/support/token/ComponentTokenInfo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package weixin.popular.support.token;
-
-import java.io.Serializable;
-
-/**
- * 第三方平台授权令牌信息
- *
- * @author Moyq5
- *
- */
-public class ComponentTokenInfo extends TokenInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
-
-}
diff --git a/src/main/java/weixin/popular/support/token/DefaultAuthorizerStorage.java b/src/main/java/weixin/popular/support/token/DefaultAuthorizerStorage.java
deleted file mode 100644
index 104ee754..00000000
--- a/src/main/java/weixin/popular/support/token/DefaultAuthorizerStorage.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package weixin.popular.support.token;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 默认authorizer_access_token信息存储类
- *
- * @author Moyq5
- *
- */
-public class DefaultAuthorizerStorage implements TokenStorage {
-
- private static final Logger logger = LoggerFactory.getLogger(DefaultAuthorizerStorage.class);
-
- // 模拟数据库表对象,每个元素为条记录
- private static Map map = new HashMap();
-
- @Override
- public RefreshInfo getOverdue() {
- // 模拟查询表,获取最近一个需要刷的刷新令牌信息
- RowData row = latest();
- if (null == row) {
- return null;
- }
- AuthorizerRefreshInfo refresh = new AuthorizerRefreshInfo();
- refresh.setAuthorizerAppId(row.getAppId());
- refresh.setAuthorizerRefreshToken(row.getRefreshToken());
- refresh.setComponentAccessToken(ComponentManager.getInstance()
- .getAccessToken(row.getComponentAppId()));
- refresh.setComponentAppId(row.getComponentAppId());
- return refresh;
- }
-
- @Override
- public long nextTime() {
- long nextTime = -1;
- // 模拟查表,获取下一个最快要到期的令牌的时间
- RowData row = latest();
- if (null != row) {
- nextTime = row.getOverdueTime();
- }
- long curTime = new Date().getTime();
- if (nextTime < curTime) {
- // 默认每间隔10分检查一次是否有令牌需要刷新,保证刷新线程持续正常进行
- nextTime = curTime + 600000;
- }
- return nextTime;
- }
-
- @Override
- public void update(TokenInfo tokenInfo) {
- AuthorizerTokenInfo info = (AuthorizerTokenInfo)tokenInfo;
- // 模拟添加或者更新表记录
- RowData row = new RowData();
- row.setAccessToken(info.getAccessToken());
- row.setAppId(info.getAppId());
- row.setComponentAppId(info.getComponentAppId());
- row.setOverdueTime(new Date().getTime() + (info.getExpiresIn()-600) * 1000);// 根据有效时长计算过期日期, 比微信服务端提前10分钟
- row.setRefreshToken(info.getRefreshToken());
- map.put(row.getComponentAppId() + info.getAppId(), row);
-
- }
-
- @Override
- public String getAccessToken(TokenType type, String componentAppId, String authorizerAppId, String openId) {
- // 模拟查询表记录并获取access_token值
- RowData rd = map.get(componentAppId + authorizerAppId);
- if (null == rd) {
- logger.warn("第三方平台公众号信息不存在:componentAppId={},authorizerAppId={}", componentAppId, authorizerAppId);
- return null;
- }
- return map.get(componentAppId + authorizerAppId).getAccessToken();
- }
-
- /**
- * 模拟查表,获取最快要到期的"1个"token
- *
- * @return
- */
- private RowData latest() {
- long nextTime = -1;
- RowData row = null;
- for (Map.Entry entry : map.entrySet()) {
- if (entry.getValue().getOverdueTime() < nextTime || nextTime == -1) {
- row = entry.getValue();
- nextTime = row.getOverdueTime();
- }
- }
- return row;
- }
-
- /**
- * 模拟数据库公众号信息表记录对象
- *
- * @author Moyq5
- *
- */
- private class RowData {
- private String appId;// 公众号appId
- private String refreshToken;// 公众号刷新令牌
- private long overdueTime;// 公众号令牌过期时间
- private String accessToken;// 当前有效的授权令牌
- private String componentAppId;// 第三方平台应用appId
-
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public String getRefreshToken() {
- return refreshToken;
- }
-
- public void setRefreshToken(String refreshToken) {
- this.refreshToken = refreshToken;
- }
-
- public long getOverdueTime() {
- return overdueTime;
- }
-
- public void setOverdueTime(long overdueTime) {
- this.overdueTime = overdueTime;
- }
-
- public String getAccessToken() {
- return accessToken;
- }
-
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- public String getComponentAppId() {
- return componentAppId;
- }
-
- public void setComponentAppId(String componentAppId) {
- this.componentAppId = componentAppId;
- }
-
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/DefaultComponentStorage.java b/src/main/java/weixin/popular/support/token/DefaultComponentStorage.java
deleted file mode 100644
index fb355017..00000000
--- a/src/main/java/weixin/popular/support/token/DefaultComponentStorage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package weixin.popular.support.token;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 默认第三方平台component_access_token信息存储类
- *
- * @author Moyq5
- *
- */
-public class DefaultComponentStorage implements TokenStorage {
-
- private static final Logger logger = LoggerFactory.getLogger(DefaultComponentStorage.class);
-
- // 模拟数据库表对象,每个元素为条记录
- public static Map map = new HashMap();
-
- @Override
- public RefreshInfo getOverdue() {
- // 模拟查询表,获取最近一个需要刷的刷新令牌信息
- RowData row = latest();
- if (null == row) {
- return null;
- }
- ComponentRefreshInfo refresh = new ComponentRefreshInfo();
- refresh.setAppId(row.getAppId());
- refresh.setAppSecret(row.getAppSecret());
- refresh.setVerifyTicket(row.getVerifyTicket());
- return refresh;
- }
-
- @Override
- public long nextTime() {
- long nextTime = -1;
- // 模拟查表,获取下一个最快要到期的令牌的时间
- RowData row = latest();
- if (null != row) {
- nextTime = row.getOverdueTime();
- }
- long curTime = new Date().getTime();
- if (nextTime < curTime) {
- // 默认每间隔10分检查一次是否有令牌需要刷新,保证刷新线程持续正常进行
- nextTime = curTime + 600000;
- }
- return nextTime;
- }
-
- @Override
- public void update(TokenInfo tokenInfo) {
- ComponentTokenInfo info = (ComponentTokenInfo)tokenInfo;
- // 模拟更新表记录
- RowData old = map.get(info.getAppId());
- RowData row = new RowData();
- row.setAccessToken(info.getAccessToken());
- row.setAppId(old.getAppId());
- row.setAppSecret(old.getAppSecret());
- row.setOverdueTime(new Date().getTime() + (info.getExpiresIn()-600) * 1000);// 根据有效时长计算过期日期, 比微信服务端提前10分钟
- row.setVerifyTicket(old.getVerifyTicket());
- map.put(old.getAppId(), row);
-
- }
-
- @Override
- public String getAccessToken(TokenType type, String componentAppId, String authorizerAppId, String openId) {
- // 模拟查询表记录并获取access_token值
- RowData rd = map.get(componentAppId);
- if (null == rd) {
- logger.warn("第三方平台信息不存在:componentAppId={}", componentAppId);
- return null;
- }
- return map.get(componentAppId).getAccessToken();
- }
-
- /**
- * 模拟查表,获取最快要到期的"1个"token
- *
- * @return
- */
- private RowData latest() {
- long nextTime = -1;
- RowData row = null;
- for (Map.Entry entry : map.entrySet()) {
- if (entry.getValue().getOverdueTime() < nextTime || nextTime == -1) {
- row = entry.getValue();
- nextTime = row.getOverdueTime();
- }
- }
- return row;
- }
-
- /**
- * 模拟数据库第三方平台应用信息表记录对象
- *
- * @author Moyq5
- *
- */
- public static class RowData {
- private String appId;// 第三方平台应用appId
- private String appSecret;// 第三方平台应用appSecret
- private String verifyTicket;// 第三方平台应用verifyTicket
- private long overdueTime;// 令牌过期时间
- private String accessToken;// 当前有效的授权令牌
- public String getAppId() {
- return appId;
- }
- public void setAppId(String appId) {
- this.appId = appId;
- }
- public String getAppSecret() {
- return appSecret;
- }
- public void setAppSecret(String appSecret) {
- this.appSecret = appSecret;
- }
- public String getVerifyTicket() {
- return verifyTicket;
- }
- public void setVerifyTicket(String verifyTicket) {
- this.verifyTicket = verifyTicket;
- }
- public long getOverdueTime() {
- return overdueTime;
- }
- public void setOverdueTime(long overdueTime) {
- this.overdueTime = overdueTime;
- }
- public String getAccessToken() {
- return accessToken;
- }
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/RefreshInfo.java b/src/main/java/weixin/popular/support/token/RefreshInfo.java
deleted file mode 100644
index 5c51a17b..00000000
--- a/src/main/java/weixin/popular/support/token/RefreshInfo.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 刷新令牌的信息,用于刷新授权令牌,如用户、公众号、第三方平台等类型的令牌
- * @author Moyq5
- *
- */
-public interface RefreshInfo {
-
-}
diff --git a/src/main/java/weixin/popular/support/token/RefreshMsgHandler.java b/src/main/java/weixin/popular/support/token/RefreshMsgHandler.java
deleted file mode 100644
index 0316e555..00000000
--- a/src/main/java/weixin/popular/support/token/RefreshMsgHandler.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- */
-package weixin.popular.support.token;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * token刷新消息(刷新API调用结果信息)控制类
- * @author Moyq5
- * @date 2016年8月4日
- */
-public class RefreshMsgHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(RefreshMsgHandler.class);
-
- public void handle(String appId, String code, String msg) {
- logger.warn("授权令牌刷新失败:appId={},code={},msg={}",
- new Object[]{appId, code, msg});
- };
-}
diff --git a/src/main/java/weixin/popular/support/token/RefreshRunnable.java b/src/main/java/weixin/popular/support/token/RefreshRunnable.java
deleted file mode 100644
index 8411fce0..00000000
--- a/src/main/java/weixin/popular/support/token/RefreshRunnable.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package weixin.popular.support.token;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * token刷新线程类
- *
- * @author Moyq5
- *
- * @param 刷新时需要的信息类
- * @param 更新时得到的信息类
- */
-public class RefreshRunnable implements Runnable {
- private static final Logger logger = LoggerFactory.getLogger(RefreshRunnable.class);
-
- /**
- * 下一个acess_token到期时间,0马上到期
- */
- private long nextTime = 0;
-
- /**
- * 任务调度管理类
- */
- private RefreshSchedulerAbstract invoker;
-
- public RefreshRunnable(RefreshSchedulerAbstract invoker) {
- this.invoker = invoker;
- }
-
- @Override
- public void run() {
- long curTime = new Date().getTime();
- if (nextTime > curTime) {
- // 还没到刷新access_token时间,跳过处理逻辑
- logger.debug("refresh skip");
- return;
- }
- try {
- TokenStorage tokenStorage = invoker.getTokenStorage();
- @SuppressWarnings("unchecked")
- T t = (T) tokenStorage.getOverdue();
- if (null != t) {
- E e = (E) invoker.execute(t);
- if (null != e) {
- tokenStorage.update(e);
- }
- }
- nextTime = tokenStorage.nextTime();
- } catch (Exception e) {
- logger.error("refresh error:", e);
- }
-
- curTime = new Date().getTime();
- if (curTime > nextTime) {
- // 默认10分检查access_token有效性一次
- nextTime = curTime + 600000;
-
- Date date = new Date();
- date.setTime(nextTime);
- logger.debug("next check time: {}",
- new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
- } else {
-
- Date date = new Date();
- date.setTime(nextTime);
- logger.debug("next refresh time: {}",
- new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
- }
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/RefreshScheduler.java b/src/main/java/weixin/popular/support/token/RefreshScheduler.java
deleted file mode 100644
index a84cdd7f..00000000
--- a/src/main/java/weixin/popular/support/token/RefreshScheduler.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 授权令牌刷新任务调度类
- *
- * @author Moyq5
- *
- */
-public interface RefreshScheduler {
-
- /**
- * 执行新刷任务
- */
- public void execute();
-}
diff --git a/src/main/java/weixin/popular/support/token/RefreshSchedulerAbstract.java b/src/main/java/weixin/popular/support/token/RefreshSchedulerAbstract.java
deleted file mode 100644
index 1fc7a87b..00000000
--- a/src/main/java/weixin/popular/support/token/RefreshSchedulerAbstract.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package weixin.popular.support.token;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 授权令牌刷新任务调度抽象类
- *
- * @author Moyq5
- *
- */
-public abstract class RefreshSchedulerAbstract
- implements RefreshScheduler {
-
- /**
- * 刷新线程默认每1分钟执行一次
- */
- private int scheduleDelay = 60;
-
- private ScheduledExecutorService service;
- private Runnable command;
-
- public RefreshSchedulerAbstract() {
- command = new RefreshRunnable(this);
- service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
-
- @Override
- public Thread newThread(Runnable r) {
- // 设置守护线程
- Thread thread = Executors.defaultThreadFactory().newThread(r);
- thread.setDaemon(true);
- return thread;
- }
- });
- service.scheduleWithFixedDelay(command, 0, scheduleDelay, TimeUnit.SECONDS);
- }
-
- /**
- * 刷新授权令牌
- *
- * @param refreshInfo
- * 刷新令牌
- * @return 新的授权令牌
- */
- protected abstract E execute(T refreshInfo);
-
- /**
- * 获取token源信息提供者
- *
- * @return
- */
- protected abstract TokenStorage getTokenStorage();
-
- @Override
- public void execute() {
- service.execute(command);
- }
-
- /**
- * 获取当前刷新线程启动频繁(单位:秒)
- *
- * @return
- */
- public int getScheduleDelay() {
- return scheduleDelay;
- }
-
- /**
- * 指定刷新线程启动频繁(单位:秒), 注意:启动频繁并不是指查检token信息的频繁, 真正是否执行token检查还跟线程上次执行结果有关,
- * 它仅相当于线程上次执行完成后,多长时间再次启动(Thread类的start方法))
- *
- * @param scheduleDelay
- * 刷新线程启动频繁(单位:秒)
- */
- public void setScheduleDelay(int scheduleDelay) {
- this.scheduleDelay = scheduleDelay;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenContext.java b/src/main/java/weixin/popular/support/token/TokenContext.java
deleted file mode 100644
index 2e9feeca..00000000
--- a/src/main/java/weixin/popular/support/token/TokenContext.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package weixin.popular.support.token;
-
-
-/**
- * access_token信息管理类的上下文类
- * @author Moyq5
- *
- */
-public class TokenContext {
-
- private RefreshScheduler refreshScheduler;
-
- private TokenStorage tokenStorage;
-
- private TokenType type;
-
- private RefreshMsgHandler refreshMsgHandler;
-
- public RefreshScheduler getRefreshScheduler() {
- return refreshScheduler;
- }
-
- public void setRefreshScheduler(RefreshScheduler refreshScheduler) {
- this.refreshScheduler = refreshScheduler;
- }
-
- public TokenStorage getTokenStorage() {
- return tokenStorage;
- }
-
- public void setTokenStorage(TokenStorage tokenStorage) {
- this.tokenStorage = tokenStorage;
- }
-
- public TokenType getType() {
- return type;
- }
-
- public void setType(TokenType type) {
- this.type = type;
- }
-
- public RefreshMsgHandler getRefreshMsgHandler() {
- return refreshMsgHandler;
- }
-
- public void setRefreshMsgHandler(RefreshMsgHandler refreshMsgHandler) {
- this.refreshMsgHandler = refreshMsgHandler;
- }
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenInfo.java b/src/main/java/weixin/popular/support/token/TokenInfo.java
deleted file mode 100644
index 0745b8e4..00000000
--- a/src/main/java/weixin/popular/support/token/TokenInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 授权令牌信息,如公众号、第三方平台等类型的令牌
- *
- * @author Moyq5
- *
- */
-public abstract class TokenInfo {
- private TokenType type;
- private String appId;
- private String accessToken;
- private int expiresIn;
-
- public TokenType getType() {
- return type;
- }
-
- public void setType(TokenType type) {
- this.type = type;
- }
-
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public String getAccessToken() {
- return accessToken;
- }
-
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- public int getExpiresIn() {
- return expiresIn;
- }
-
- public void setExpiresIn(int expiresIn) {
- this.expiresIn = expiresIn;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenManager.java b/src/main/java/weixin/popular/support/token/TokenManager.java
deleted file mode 100644
index 1fc345cd..00000000
--- a/src/main/java/weixin/popular/support/token/TokenManager.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 授权令牌管理抽象
- *
- * @author Moyq5
- *
- */
-public abstract class TokenManager {
-
- protected TokenContext context;
-
- protected TokenManager(TokenContext context) {
- this.context = context;
- }
-
- public synchronized void refreshOverdue() {
- context.getRefreshScheduler().execute();
- }
-
- public void addTokenInfo(T tokenInfo) {
- context.getTokenStorage().update(tokenInfo);
- }
-
- public TokenContext getContext() {
- return context;
- }
-
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenStorage.java b/src/main/java/weixin/popular/support/token/TokenStorage.java
deleted file mode 100644
index b9cd2f93..00000000
--- a/src/main/java/weixin/popular/support/token/TokenStorage.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package weixin.popular.support.token;
-
-
-/**
- * 令牌信息提供者
- * @author Moyq5
- *
- */
-public interface TokenStorage {
-
- /**
- * 获取最快要过期的刷新令牌
- * @return
- */
- public RefreshInfo getOverdue();
-
- /**
- * 获取接下来会有令牌过期的日期时间(毫秒)
- * @return
- */
- public long nextTime();
-
- /**
- * 保存新的授权令牌
- * @param tokenInfo
- */
- public void update(TokenInfo tokenInfo);
-
- /**
- * 根据应用appId和类型获取 access_token
- * @param type
- * @param componentAppId
- * @param authorizerAppId
- * @param openId
- * @return
- */
- public String getAccessToken(TokenType type, String componentAppId, String authorizerAppId, String openId);
-
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenType.java b/src/main/java/weixin/popular/support/token/TokenType.java
deleted file mode 100644
index b8b72667..00000000
--- a/src/main/java/weixin/popular/support/token/TokenType.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * 授权令牌类型
- *
- * @author Moyq5
- *
- */
-public enum TokenType {
- /**
- * 第三方平台
- */
- COMPONENT,
- /**
- * 公众号
- */
- AUTHORIZER;
-}
diff --git a/src/main/java/weixin/popular/support/token/TokenUtils.java b/src/main/java/weixin/popular/support/token/TokenUtils.java
deleted file mode 100644
index ed84c1e3..00000000
--- a/src/main/java/weixin/popular/support/token/TokenUtils.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package weixin.popular.support.token;
-
-/**
- * token管理工具类
- *
- * @author Moyq5
- *
- */
-public abstract class TokenUtils {
-
- /**
- * 获取第三方平台"应用"access_token
- * @param componentAppId
- * @return
- */
- public static String getComponentAccessToken(String componentAppId) {
- return ComponentManager.getInstance().getAccessToken(componentAppId);
- }
-
- /**
- * 获取第三方平台"公众号"access_token
- * @param componentAppId
- * @param authorizerAppId
- * @return
- */
- public static String getAuthorizerAccessToken(String componentAppId, String authorizerAppId) {
- return AuthorizerManager.getInstance().getAccessToken(componentAppId, authorizerAppId);
- }
-
- /**
- * 指定第三方平台“应用”token信息存储实现,
- * 默认使用DefaultComponentStorage
- * @param tokenStorage
- * @see DefaultComponentStorage
- */
- public static void setComponentTokenStorage(TokenStorage tokenStorage) {
- ComponentManager.getInstance().getContext().setTokenStorage(tokenStorage);
- }
-
- /**
- * 指定第三方平台“公众号”token信息存储实现,
- * 默认使用DefaultAuthorizerStorage
- * @param tokenStorage
- * @see DefaultAuthorizerStorage
- */
- public static void setAuthorizerTokenStorage(TokenStorage tokenStorage) {
- AuthorizerManager.getInstance().getContext().setTokenStorage(tokenStorage);
- }
-
- /**
- * 添加第三方平台“应用”授权信息,
- * 即在系统中增加一个第三方平台应用的信息时,用来记录新应用的授权信息
- * @param tokenInfo
- */
- public static void addComponentTokenInfo(ComponentTokenInfo tokenInfo) {
- ComponentManager.getInstance().addTokenInfo(tokenInfo);
- }
-
- /**
- * 添加第三方平台“公众号”授权信息,
- * 即公众号授权第三方平台应用后,用来记录授权信息
- * @param tokenInfo
- */
- public static void addAuthorizerTokenInfo(AuthorizerTokenInfo tokenInfo) {
- AuthorizerManager.getInstance().addTokenInfo(tokenInfo);
- }
-
- /**
- * 第三方平台授权令牌刷新(API请求)结果消息处理
- * @param handler
- */
- public static void setComponentTokenRefreshMsgHandler(RefreshMsgHandler handler) {
- ComponentManager.getInstance().getContext().setRefreshMsgHandler(handler);
- }
-
- /**
- * 公众号授权令牌刷新(API请求)结果消息处理
- * @param handler
- */
- public static void setAuthorizerTokenRefreshMsgHandler(RefreshMsgHandler handler) {
- AuthorizerManager.getInstance().getContext().setRefreshMsgHandler(handler);
- }
-}
diff --git a/src/main/java/weixin/popular/support/token/package-info.java b/src/main/java/weixin/popular/support/token/package-info.java
deleted file mode 100644
index 6004f5b5..00000000
--- a/src/main/java/weixin/popular/support/token/package-info.java
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/**
- * 该包下主要存放token刷新机制管理类,如公众号授权令牌信息(authorizer_access_token)、
- * 第三方平台授权令牌信息(component_access_token),当然还可以扩展到用户授权令牌管理,
- * 目前只实现了前面两种。
- *
本机制可以定时刷新令牌信息、可自定义令牌信息存储类,可以将它们保存
- * 到比如数据库或者本地磁盘,要达到这需求,只要实现TokenStorage接口,然后调用相应的:
- *
TokenUtils.setComponentTokenStorage(TokenStorage tokenStorage)
- *
TokenUtils.setAuthorizerTokenStorage(TokenStorage tokenStorage)
- *
如果不实现TokenStorage接口,则默认分别使用DefaultAuthorizerStorage和DefaultComponentStorage
- * 自定义TokenStorage接口实现时可参考他们。
- *
特别说明,当使用DefaultComponentStorage时,需要手动添加相应的第三平台应用信息(因为实际场景中
- * 这类信息一般是来自配置文件或者数据库的),DefaultAuthorizerStorage则不需要这么做,如:
- *
- *
// 自己的第三方应用信息
- *
ComponentConfig myCfg = ComponentConfig.getInstance();
- *
- *
// 初始化时,将自己的应用信息添加到DefaultComponentStorage
- *
RowData row = new RowData();
- *
row.setAccessToken(null);
- *
row.setAppId(myCfg.getAppId());
- *
row.setAppSecret(myCfg.getAppSecret());
- *
row.setOverdueTime(0);
- *
row.setVerifyTicket(null);
- *
Map map = new HashMap();
- *
map.put(myCfg.getAppId(), row);
- *
DefaultComponentStorage.map = map;
- *
- *
// 并且,需要在接受微信verifyTicket推送的地方执行下面的语句:
- *
DefaultComponentStorage.map.get(myCfg.getAppId()).setVerifyTicket(verifyTicket);
- *
- *
- *
// 获取并存储公众号授权第三方平台信息如下:
- *
- *
// 第三方平台授权令牌
- *
String accessToken = TokenUtils.getComponentAccessToken(myCfg.getAppId());
- *
- *
// 获取公众号授权令牌信息
- *
ApiQueryAuthResult authResult = ComponentAPI.api_query_auth(accessToken, myCfg.getAppId(), authCode);
- *
Authorization_info authInfo = authResult.getAuthorization_info();
- *
- *
// 保存公众号授权令牌信息
- *
AuthorizerTokenInfo tokenInfo = new AuthorizerTokenInfo();
- *
tokenInfo.setAccessToken(authInfo.getAuthorizer_access_token());
- *
tokenInfo.setAppId(authInfo.getAuthorizer_appid());
- *
tokenInfo.setExpiresIn(authInfo.getExpires_in());
- *
tokenInfo.setRefreshToken(authInfo.getAuthorizer_refresh_token());
- *
tokenInfo.setType(TokenType.AUTHORIZER);
- *
TokenUtils.addAuthorizerTokenInfo(tokenInfo);
- *
- *
- *
// 在其它地方用到公众号在第三平台的授权令牌时,可以这样:
- *
- *
// 第三方平台公众号授权令牌
- *
String accessToken = TokenUtils.getAuthorizerAccessToken(myCfg.getAppId(), authorizeAppId);
- *
- * @author Moyq5
- *
- */
-package weixin.popular.support.token;
-
diff --git a/src/test/java/weixin/popular/test/CardTest.java b/src/test/java/weixin/popular/test/CardTest.java
deleted file mode 100644
index 35c22822..00000000
--- a/src/test/java/weixin/popular/test/CardTest.java
+++ /dev/null
@@ -1,478 +0,0 @@
-package weixin.popular.test;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.junit.Test;
-
-import weixin.popular.api.CardAPI;
-import weixin.popular.api.DataCubeAPI;
-import weixin.popular.bean.BaseResult;
-import weixin.popular.bean.card.AdvancedInfo;
-import weixin.popular.bean.card.AdvancedInfoAbstract;
-import weixin.popular.bean.card.AdvancedInfoTextImage;
-import weixin.popular.bean.card.AdvancedInfoTimeLimit;
-import weixin.popular.bean.card.AdvancedInfoUseCondition;
-import weixin.popular.bean.card.BaseInfo;
-import weixin.popular.bean.card.BaseInfoDateInfo;
-import weixin.popular.bean.card.BaseInfoSku;
-import weixin.popular.bean.card.CardType;
-import weixin.popular.bean.card.Cash;
-import weixin.popular.bean.card.CashCard;
-import weixin.popular.bean.card.batchget.BatchGet;
-import weixin.popular.bean.card.batchget.BatchGetResult;
-import weixin.popular.bean.card.code.consume.CodeConsume;
-import weixin.popular.bean.card.code.consume.CodeConsumeResult;
-import weixin.popular.bean.card.code.decrypt.CodeDecrypt;
-import weixin.popular.bean.card.code.decrypt.CodeDecryptResult;
-import weixin.popular.bean.card.code.get.CodeGet;
-import weixin.popular.bean.card.code.get.CodeGetResult;
-import weixin.popular.bean.card.code.unavailable.CodeUnavailable;
-import weixin.popular.bean.card.code.update.CodeUpdate;
-import weixin.popular.bean.card.create.CreateResult;
-import weixin.popular.bean.card.get.GetCashResult;
-import weixin.popular.bean.card.get.GetDiscountResult;
-import weixin.popular.bean.card.get.GetGeneralCouponResult;
-import weixin.popular.bean.card.get.GetGrouponResult;
-import weixin.popular.bean.card.landingpage.create.LandingPageCreate;
-import weixin.popular.bean.card.landingpage.create.LandingPageCreateCard;
-import weixin.popular.bean.card.landingpage.create.LandingPageCreateResult;
-import weixin.popular.bean.card.modifystock.ModifyStock;
-import weixin.popular.bean.card.mpnews.gethtml.MpNewsGetHtml;
-import weixin.popular.bean.card.mpnews.gethtml.MpNewsGetHtmlResult;
-import weixin.popular.bean.card.paycell.set.PaySellSet;
-import weixin.popular.bean.card.qrcode.create.ActionInfo;
-import weixin.popular.bean.card.qrcode.create.ActionInfoCard;
-import weixin.popular.bean.card.qrcode.create.ActionInfoMultiple;
-import weixin.popular.bean.card.qrcode.create.ActionInfoMultipleCard;
-import weixin.popular.bean.card.qrcode.create.ActionInfoMultipleCardItem;
-import weixin.popular.bean.card.qrcode.create.QrCodeCreate;
-import weixin.popular.bean.card.qrcode.create.QrCodeCreateMultiple;
-import weixin.popular.bean.card.qrcode.create.QrCodeCreateResult;
-import weixin.popular.bean.card.selfconsumecelll.set.SelfConsumeCellSet;
-import weixin.popular.bean.card.testwhitelist.set.TestWhiteListSet;
-import weixin.popular.bean.card.user.getcardlist.UserGetCardList;
-import weixin.popular.bean.card.user.getcardlist.UserGetCardListResult;
-import weixin.popular.bean.datacube.getcardbizuininfo.BizuinInfo;
-import weixin.popular.bean.datacube.getcardbizuininfo.BizuinInfoResult;
-import weixin.popular.bean.datacube.getcardcardinfo.CardInfo;
-import weixin.popular.bean.datacube.getcardcardinfo.CardInfoResult;
-import weixin.popular.bean.datacube.getcardmembercardinfo.MemberCardInfo;
-import weixin.popular.bean.datacube.getcardmembercardinfo.MemberCardInfoResult;
-
-/**
- * 卡券测试类
- *
- * @author Moyq5
- *
- */
-public class CardTest extends TokenTest {
-
- /**
- * 创建卡券
- */
- @Test
- public void create() {
- // CashCard(代金券) DiscountCard(折扣券)、GeneralCouponCard(优惠券)、
- // GiftCard(兑换券)、GrouponCard(团购券)
- CashCard cashCard = new CashCard();
- Cash cash = new Cash();
- AdvancedInfo advancedInfo = new AdvancedInfo();
- BaseInfo baseInfo = new BaseInfo();
- AdvancedInfoAbstract abstractInfo = new AdvancedInfoAbstract();
- List textImageList = new ArrayList();
- List timeLimit = new ArrayList();
- AdvancedInfoUseCondition useCondition = new AdvancedInfoUseCondition();
- BaseInfoDateInfo dateInfo = new BaseInfoDateInfo();
- BaseInfoSku sku = new BaseInfoSku();
-
- cashCard.setCash(cash);
-
- cash.setAdvancedInfo(advancedInfo);
- cash.setBaseInfo(baseInfo);
- cash.setLeastCost(0);
- cash.setReduceCost(10);
-
- advancedInfo.setAbstractInfo(abstractInfo);
- advancedInfo.setBusinessService(new String[]{"BIZ_SERVICE_FREE_PARK"});
- advancedInfo.setTextImageList(textImageList);
- advancedInfo.setTimeLimit(timeLimit);
- advancedInfo.setUseCondition(useCondition);
-
- for (int i = 0; i < 1; i++) {
- AdvancedInfoTextImage textImage = new AdvancedInfoTextImage();
- textImage.setImageUrl("http://mmbiz.qpic.cn/mmbiz/hYkZGWmGqRPpIDiatjgB6rowtU0q9HNKHq0Z2j7D5w56aClzIBF22Y5CwvfkDmyj5MLVY8sicxoHv0vDpam0at1A/0");
- textImage.setText("图片"+i);
- textImageList.add(textImage);
- }
-
- for (int i = 0; i < 1; i++) {
- AdvancedInfoTimeLimit limit = new AdvancedInfoTimeLimit();
- limit.setBeginHour(8);
- limit.setBeginMinute(0);
- limit.setEndHour(18);
- limit.setEndMinute(0);
- limit.setType("SUNDAY");
- timeLimit.add(limit);
- }
-
- useCondition.setAcceptCategory(null);
- useCondition.setCanUseWithOtherDiscount(true);
- useCondition.setLeastCost(10);
- //useCondition.setObjectUseFor(null);
- useCondition.setRejectCategory(null);
-
- abstractInfo.setAbstractText("封面摘要简介。");
- abstractInfo.setIconUrlList(new String[]{"http://mmbiz.qpic.cn/mmbiz/hYkZGWmGqRPpIDiatjgB6rowtU0q9HNKHSSjMMNogkR3Yia1gMzY6v6eAsgt5gibZmKCGfscD9R8JDdnt9HZHDLmw/0"});
-
- baseInfo.setBindOpenid(false);
- baseInfo.setBrandName("商户名字");
- baseInfo.setCanGiveFriend(true);
- baseInfo.setCanShare(true);
- baseInfo.setCenterSubTitle("立即享受优惠1");
- baseInfo.setCenterTitle("立即使用1");
- baseInfo.setCenterUrl("http://www.esyto.com");
- baseInfo.setCodeType("CODE_TYPE_QRCODE");
- baseInfo.setColor("Color010");
- baseInfo.setCustomUrl("http://www.esyto.com");
- baseInfo.setCustomUrlName("立即使用!");
- baseInfo.setCustomUrlSubTitle("更多惊喜!");
- baseInfo.setDateInfo(dateInfo);
- baseInfo.setDescription("卡券使用说明!!");
- baseInfo.setGetLimit(2);
- baseInfo.setLocationIdList(new Integer[]{460999770});
- baseInfo.setLogoUrl("http://mmbiz.qpic.cn/mmbiz/hYkZGWmGqRPpIDiatjgB6rowtU0q9HNKHgZ4eMAQCfNGgsVqKa1bjL8w2QovjrWloOAVlokQ0akmSgxyKTYHic1A/0");
- baseInfo.setNotice("一个月内使用有效");
- baseInfo.setPromotionUrl("http://www.esyto.com");
- baseInfo.setPromotionUrlName("产品介绍");
- baseInfo.setPromotionUrlSubTitle("卖场大优惠。");
- baseInfo.setServicePhone("400-6600-2036");
- baseInfo.setSku(sku);
- baseInfo.setSource("大众点评");
- baseInfo.setSubTitle("送您5元代金券");
- baseInfo.setTitle("5元代金券");
- baseInfo.setUseCustomCode(false);
-
- //dateInfo.setBeginTimestamp(beginTimestamp);
- dateInfo.setEndTimestamp((int)(new Date().getTime()/1000) + 30 *24 *60 *60);// 30天后过期
- dateInfo.setFixedBeginTerm(0);
- dateInfo.setFixedTerm(30);
- dateInfo.setType("DATE_TYPE_FIX_TERM");
-
- sku.setQuantity(100);
-
- CreateResult result = CardAPI.create(accessToken, cashCard);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 设置买单功能
- */
- @Test
- public void paycell() {
- PaySellSet cardSet = new PaySellSet();
- cardSet.setCardId("pkMP8v-JC_03FJQEveLW93ssQz0I");
- cardSet.setIsOpen(true);
- BaseResult result = CardAPI.payCellSet(accessToken, cardSet);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 设置自助核销功能
- */
- @Test
- public void selfconsumecell() {
- SelfConsumeCellSet cardSet = new SelfConsumeCellSet();
- cardSet.setCardId("pkMP8v-JC_03FJQEveLW93ssQz0I");
- cardSet.setIsOpen(true);
- BaseResult result = CardAPI.selfconsumecellSet(accessToken, cardSet);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 卡券投放-设置扫描二维码领取单张卡券
- */
- @Test
- public void qrcodeCreate() {
- QrCodeCreate action = new QrCodeCreate();
- ActionInfo actionInfo = new ActionInfo();
- ActionInfoCard card = new ActionInfoCard();
-
- action.setActionInfo(actionInfo);
- action.setExpireSeconds(null);
-
- actionInfo.setCard(card);
-
- card.setCardId("pkMP8vzXtVHX2UYPh_DtRypc_hK0");
- card.setCode(null);
- card.setIsUniqueCode(false);
- card.setOpenid(null);
- card.setOuterId(1);
- card.setOuterStr("测试卡券");
-
- QrCodeCreateResult result = CardAPI.qrcodeCreate(accessToken, action);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 卡券投放-设置扫描二维码领取多张卡券
- */
- @Test
- public void qrcodeCreateMultiple() {
- QrCodeCreateMultiple action = new QrCodeCreateMultiple();
- ActionInfoMultiple actionInfo = new ActionInfoMultiple();
- ActionInfoMultipleCard multipleCard = new ActionInfoMultipleCard();
- List cardList = new ArrayList();
-
- action.setActionInfo(actionInfo);
-
- actionInfo.setMultipleCard(multipleCard);
-
- multipleCard.setCardList(cardList);
-
- ActionInfoMultipleCardItem card1 = new ActionInfoMultipleCardItem();
- card1.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- card1.setCode(null);
- cardList.add(card1);
-
- ActionInfoMultipleCardItem card2 = new ActionInfoMultipleCardItem();
- card2.setCardId("pkMP8v2nZLbH4Xps-J56fZsLhzhY");
- card2.setCode(null);
- cardList.add(card2);
-
- QrCodeCreateResult result = CardAPI.qrcodeCreate(accessToken, action);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 卡券发放-创建货架接口
- */
- @Test
- public void landingpageCreate() {
- LandingPageCreate landingPage = new LandingPageCreate();
- List cardList = new ArrayList();
-
- landingPage.setBanner("http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0");
- landingPage.setCanShare(true);
- landingPage.setCardList(cardList);
- landingPage.setPageTitle("惠城优惠大派送");
- landingPage.setScene("SCENE_NEAR_BY");
-
- LandingPageCreateCard card1 = new LandingPageCreateCard();
- card1.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- card1.setThumbUrl("http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0");
- cardList.add(card1);
-
- LandingPageCreateCard card2 = new LandingPageCreateCard();
- card2.setCardId("pkMP8v2nZLbH4Xps-J56fZsLhzhY");
- card2.setThumbUrl("http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0");
- cardList.add(card2);
-
- LandingPageCreateResult result = CardAPI.landingPageCreate(accessToken, landingPage);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 获取图文消息群发卡券的content
- */
- @Test
- public void mpnewsGethtml() {
- MpNewsGetHtml mpnews = new MpNewsGetHtml();
- mpnews.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- MpNewsGetHtmlResult result = CardAPI.mpNewsGetHtml(accessToken, mpnews);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 设置测试白名单
- */
- @Test
- public void testwhitelistSet() {
- TestWhiteListSet whiteList = new TestWhiteListSet();
- whiteList.setOpenid(null);
- whiteList.setUsername(new String[]{"mo_yq5"});
- BaseResult result = CardAPI.testWhiteListSet(accessToken, whiteList);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 核销卡券-查询Code接口
- */
- @Test
- public void codeGet() {
- CodeGet codeGet = new CodeGet();
- codeGet.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- codeGet.setCheckConsume(true);
- codeGet.setCode("12343");
- CodeGetResult result = CardAPI.codeGet(accessToken, codeGet);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 核销卡券-核销Code接口
- */
- @Test
- public void codeConsume() {
- CodeConsume codeConsume = new CodeConsume();
- codeConsume.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- codeConsume.setCode("12343");
- CodeDecryptResult result = CardAPI.codeConsume(accessToken, codeConsume);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 核销卡券-Code解码接口
- */
- @Test
- public void codeDecrypt() {
- CodeDecrypt codeDecrypt = new CodeDecrypt();
- codeDecrypt.setEncryptCode("XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE");
- CodeConsumeResult result = CardAPI.codeDecrypt(accessToken, codeDecrypt);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 管理卡券-获取用户已领取卡券
- */
- @Test
- public void userGetcardlist() {
- UserGetCardList userGetCardList = new UserGetCardList();
- userGetCardList.setCardId(null);
- userGetCardList.setOpenid("okMP8v297b2i8Q5I7_qcwrvizDPM");
- UserGetCardListResult result = CardAPI.userGetCardList(accessToken, userGetCardList);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 查看卡券详情
- */
- @Test
- public void get() {
-
- weixin.popular.bean.card.get.GetResult> result = CardAPI.getByCardId(accessToken, "pkMP8vwCai4ipiriDAf6_XyDnGyg");
- System.out.print(result.getErrmsg());
- if (!result.isSuccess()) {
- return;
- }
- CardType cardType = CardType.valueOf(result.getCard().getCardType().toUpperCase());
- switch (cardType) {
- case CASH:
- GetCashResult cashResult = (GetCashResult)result;
- break;
- case DISCOUNT:
- GetDiscountResult discountResult = (GetDiscountResult)result;
- break;
- case GENERAL_COUPON:
- GetGeneralCouponResult couponResult = (GetGeneralCouponResult)result;
- break;
- case GROUPON:
- GetGrouponResult grouponResult = (GetGrouponResult)result;
- break;
- // ...其它卡券类型
- default:
- break;
- }
-
- }
-
- /**
- * 批量查询卡券列表
- */
- @Test
- public void batchget() {
- BatchGet batchget = new BatchGet();
- batchget.setCount(10);
- batchget.setOffset(0);
- batchget.setStatusList(null);
- BatchGetResult result = CardAPI.batchGet(accessToken, batchget);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 修改库存
- */
- @Test
- public void modifystock() {
- ModifyStock modifystock = new ModifyStock();
- modifystock.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- modifystock.setIncreaseStockValue(10);
- modifystock.setReduceStockValue(5);
- BaseResult result = CardAPI.modifyStock(accessToken, modifystock);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 更改Code
- */
- @Test
- public void codeUpdate() {
- CodeUpdate codeUpdate = new CodeUpdate();
- codeUpdate.setCardId("pkMP8vwCai4ipiriDAf6_XyDnGyg");
- codeUpdate.setCode("123456");
- codeUpdate.setNewCode("678901");
- BaseResult result = CardAPI.codeUpdate(accessToken, codeUpdate);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 删除卡券
- */
- @Test
- public void delete() {
- BaseResult result = CardAPI.deleteByCardId(accessToken, "pkMP8vzXtVHX2UYPh_DtRypc_hK0");
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 设置卡券失效
- */
- @Test
- public void codeUnavailable() {
- CodeUnavailable codeUnavailable = new CodeUnavailable();
- codeUnavailable.setCardId("pFS7Fjg8kV1IdDz01r4SQwMkuCKc");
- codeUnavailable.setCode("12312313");
- BaseResult result = CardAPI.codeUnavailable(accessToken, codeUnavailable);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 拉取卡券概况数据
- */
- @Test
- public void bizuinInfo() {
- BizuinInfo bizuinCube = new BizuinInfo();
- bizuinCube.setBeginDate("2016-05-01");
- bizuinCube.setCondSource(1);
- bizuinCube.setEndDate("2016-05-30");
- BizuinInfoResult result = DataCubeAPI.getCardBizuinInfo(accessToken, bizuinCube);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 获取免费券数据
- */
- @Test
- public void freeCardCube() {
- CardInfo freeCardCube = new CardInfo();
- freeCardCube.setBeginDate("2016-05-01");
- freeCardCube.setCardId("pFS7Fjg8kV1IdDz01r4SQwMkuCKc");
- freeCardCube.setCondSource(1);
- freeCardCube.setEndDate("2016-05-30");
- CardInfoResult result = DataCubeAPI.getCardCardInfo(accessToken, freeCardCube);
- System.out.print(result.getErrmsg());
- }
-
- /**
- * 拉取会员卡数据
- */
- @Test
- public void memberCardInfo() {
- MemberCardInfo memberCardCube = new MemberCardInfo();
- memberCardCube.setBeginDate("2016-05-01");
- memberCardCube.setCondSource(1);
- memberCardCube.setEndDate("2016-05-30");
- MemberCardInfoResult result = DataCubeAPI.getCardMemberCardInfo(accessToken, memberCardCube);
- System.out.print(result.getErrmsg());
- }
-}
diff --git a/src/test/java/weixin/popular/test/MediaTest.java b/src/test/java/weixin/popular/test/MediaTest.java
deleted file mode 100644
index a5db7346..00000000
--- a/src/test/java/weixin/popular/test/MediaTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package weixin.popular.test;
-
-import java.io.File;
-
-import org.junit.Test;
-import weixin.popular.api.MediaAPI;
-import weixin.popular.bean.media.UploadimgResult;
-
-/**
- *
- *
- * @author Moyq5
- *
- */
-public class MediaTest extends TokenTest {
-
- /**
- * 上传图文消息内的图片获取URL
- */
- @Test
- public void mediaUploadimg() {
-
- File file = new File("C:\\Users\\moyq5\\Desktop\\952.png");
- UploadimgResult result = MediaAPI.mediaUploadimg(accessToken, file);
- System.out.println(result.getErrmsg());
- System.out.println(result.getUrl());
- }
-
-}
diff --git a/src/test/java/weixin/popular/test/MenuTest.java b/src/test/java/weixin/popular/test/MenuTest.java
deleted file mode 100644
index c1e0bd4d..00000000
--- a/src/test/java/weixin/popular/test/MenuTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package weixin.popular.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-import weixin.popular.api.MenuAPI;
-import weixin.popular.api.SnsAPI;
-import weixin.popular.bean.BaseResult;
-import weixin.popular.bean.menu.Button;
-import weixin.popular.bean.menu.MenuButtons;
-
-
-/**
- * Unit test for simple App.
- */
-public class MenuTest extends TokenTest {
-
- @Test
- public void create() {
- MenuButtons menuButtons = new MenuButtons();
-
- // 产品
- Button bt1 = new Button();
- bt1.setName("产品");
- List