From ef6e2dd6c03258446dec9f437c3400534917dc06 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sat, 28 Mar 2020 18:10:38 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3javadoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/impl/WxMaRedisConfigImpl.java | 2 + .../me/chanjar/weixin/mp/api/WxMpService.java | 61 +++- .../bean/result/WxMpCurrentAutoReplyInfo.java | 1 + .../mp/api/impl/BaseWxMpServiceImplTest.java | 296 ++++++++++++++++++ 4 files changed, 357 insertions(+), 3 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConfigImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConfigImpl.java index a66ad1fa8..b2ef782d4 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConfigImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConfigImpl.java @@ -9,6 +9,8 @@ import redis.clients.jedis.JedisPool; *
  * 需要引入依赖jedis-lock,才能使用该类。
  * 
+ * + * @author winter */ public class WxMaRedisConfigImpl extends AbstractWxMaRedisConfig { diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java index 2d95b4f4e..7bff10c81 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java @@ -28,12 +28,19 @@ public interface WxMpService { * 验证消息的确来自微信服务器. * 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN * + * + * @param nonce 随机串 + * @param signature 签名 + * @param timestamp 时间戳 + * @return 是否验证通过 */ boolean checkSignature(String timestamp, String nonce, String signature); /** * 获取access_token, 不强制刷新access_token. * + * @return token + * @throws WxErrorException . * @see #getAccessToken(boolean) */ String getAccessToken() throws WxErrorException; @@ -50,13 +57,18 @@ public interface WxMpService { * 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN * * - * @param forceRefresh 强制刷新 + * @param forceRefresh 是否强制刷新 + * @return token + * @throws WxErrorException . */ String getAccessToken(boolean forceRefresh) throws WxErrorException; /** * 获得ticket,不强制刷新ticket. * + * @param type ticket 类型 + * @return ticket + * @throws WxErrorException . * @see #getTicket(TicketType, boolean) */ String getTicket(TicketType type) throws WxErrorException; @@ -68,12 +80,17 @@ public interface WxMpService { * * * @param forceRefresh 强制刷新 + * @param type ticket类型 + * @return ticket + * @throws WxErrorException . */ String getTicket(TicketType type, boolean forceRefresh) throws WxErrorException; /** * 获得jsapi_ticket,不强制刷新jsapi_ticket. * + * @return jsapi ticket + * @throws WxErrorException . * @see #getJsapiTicket(boolean) */ String getJsapiTicket() throws WxErrorException; @@ -87,6 +104,8 @@ public interface WxMpService { * * * @param forceRefresh 强制刷新 + * @return jsapi ticket + * @throws WxErrorException . */ String getJsapiTicket(boolean forceRefresh) throws WxErrorException; @@ -96,6 +115,10 @@ public interface WxMpService { * * 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN * + * + * @param url 地址 + * @return 生成的签名对象 + * @throws WxErrorException . */ WxJsapiSignature createJsapiSignature(String url) throws WxErrorException; @@ -104,6 +127,10 @@ public interface WxMpService { * 长链接转短链接接口. * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口 * + * + * @param longUrl 长url + * @return 生成的短地址 + * @throws WxErrorException . */ String shortUrl(String longUrl) throws WxErrorException; @@ -112,6 +139,10 @@ public interface WxMpService { * 语义查询接口. * 详情请见:http://mp.weixin.qq.com/wiki/index.php?title=语义理解 * + * + * @param semanticQuery 查询条件 + * @return 查询结果 + * @throws WxErrorException . */ WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException; @@ -136,6 +167,8 @@ public interface WxMpService { * * * @param redirectURI 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encode + * @param scope scope + * @param state state * @return url */ String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state); @@ -145,6 +178,10 @@ public interface WxMpService { * 用code换取oauth2的access token. * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息 * + * + * @param code code + * @return token对象 + * @throws WxErrorException . */ WxMpOAuth2AccessToken oauth2getAccessToken(String code) throws WxErrorException; @@ -152,6 +189,10 @@ public interface WxMpService { *
    * 刷新oauth2的access token.
    * 
+ * + * @param refreshToken 刷新token + * @return 新的token对象 + * @throws WxErrorException . */ WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken) throws WxErrorException; @@ -160,7 +201,10 @@ public interface WxMpService { * 用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以. * * - * @param lang zh_CN, zh_TW, en + * @param oAuth2AccessToken token对象 + * @param lang zh_CN, zh_TW, en + * @return 用户对象 + * @throws WxErrorException . */ WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken oAuth2AccessToken, String lang) throws WxErrorException; @@ -168,6 +212,9 @@ public interface WxMpService { *
    * 验证oauth2的access token是否有效.
    * 
+ * + * @param oAuth2AccessToken token对象 + * @return 是否有效 */ boolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken); @@ -176,6 +223,9 @@ public interface WxMpService { * 获取微信服务器IP地址 * http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html * + * + * @return 微信服务器ip地址数组 + * @throws WxErrorException . */ String[] getCallbackIP() throws WxErrorException; @@ -188,6 +238,7 @@ public interface WxMpService { * * @param action 执行的检测动作 * @param operator 指定平台从某个运营商进行检测 + * @return 检测结果 * @throws WxErrorException . */ WxNetCheckResult netCheck(String action, String operator) throws WxErrorException; @@ -195,7 +246,7 @@ public interface WxMpService { /** *
    * 获取公众号的自动回复规则.
-   * http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751299&token=&lang=zh_CN
+   * https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Getting_Rules_for_Auto_Replies.html
    * 开发者可以通过该接口,获取公众号当前使用的自动回复规则,包括关注后自动回复、消息自动回复(60分钟内触发一次)、关键词自动回复。
    * 请注意:
    * 1、第三方平台开发者可以通过本接口,在旗下公众号将业务授权给你后,立即通过本接口检测公众号的自动回复配置,并通过接口再次给公众号设置好自动回复规则,以提升公众号运营者的业务体验。
@@ -207,6 +258,9 @@ public interface WxMpService {
    * http请求方式: GET(请使用https协议)
    * https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN
    * 
+ * + * @return 公众号的自动回复规则 + * @throws WxErrorException . */ WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException; @@ -524,6 +578,7 @@ public interface WxMpService { /** * 返回图像处理接口的实现类对象,以方便调用其各个接口. + * * @return WxMpImgProcService */ WxMpImgProcService getImgProcService(); diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCurrentAutoReplyInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCurrentAutoReplyInfo.java index d702eeaf8..7473bb132 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCurrentAutoReplyInfo.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCurrentAutoReplyInfo.java @@ -14,6 +14,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; /** *
  * 公众号的自动回复规则.
+ * 参考文档地址:https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Getting_Rules_for_Auto_Replies.html
  * Created by Binary Wang on 2017-7-8.
  * 
* diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java index e0b2471bd..f35a7d465 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java @@ -151,4 +151,300 @@ public class BaseWxMpServiceImplTest { assertEquals(set.size(), 1); } + + @Test + public void testCheckSignature() { + } + + @Test + public void testGetTicket() { + } + + @Test + public void testTestGetTicket() { + } + + @Test + public void testGetJsapiTicket() { + } + + @Test + public void testTestGetJsapiTicket() { + } + + @Test + public void testCreateJsapiSignature() { + } + + @Test + public void testGetAccessToken() { + } + + @Test + public void testSemanticQuery() { + } + + @Test + public void testOauth2buildAuthorizationUrl() { + } + + @Test + public void testBuildQrConnectUrl() { + } + + @Test + public void testOauth2getAccessToken() { + } + + @Test + public void testOauth2refreshAccessToken() { + } + + @Test + public void testOauth2getUserInfo() { + } + + @Test + public void testOauth2validateAccessToken() { + } + + @Test + public void testGetCurrentAutoReplyInfo() { + } + + @Test + public void testClearQuota() { + } + + @Test + public void testGet() { + } + + @Test + public void testTestGet() { + } + + @Test + public void testPost() { + } + + @Test + public void testTestPost() { + } + + @Test + public void testExecute() { + } + + @Test + public void testTestExecute() { + } + + @Test + public void testExecuteInternal() { + } + + @Test + public void testGetWxMpConfigStorage() { + } + + @Test + public void testSetWxMpConfigStorage() { + } + + @Test + public void testSetMultiConfigStorages() { + } + + @Test + public void testTestSetMultiConfigStorages() { + } + + @Test + public void testAddConfigStorage() { + } + + @Test + public void testRemoveConfigStorage() { + } + + @Test + public void testSetRetrySleepMillis() { + } + + @Test + public void testSetMaxRetryTimes() { + } + + @Test + public void testGetKefuService() { + } + + @Test + public void testGetMaterialService() { + } + + @Test + public void testGetMenuService() { + } + + @Test + public void testGetUserService() { + } + + @Test + public void testGetUserTagService() { + } + + @Test + public void testGetQrcodeService() { + } + + @Test + public void testGetCardService() { + } + + @Test + public void testGetDataCubeService() { + } + + @Test + public void testGetBlackListService() { + } + + @Test + public void testGetStoreService() { + } + + @Test + public void testGetTemplateMsgService() { + } + + @Test + public void testGetSubscribeMsgService() { + } + + @Test + public void testGetDeviceService() { + } + + @Test + public void testGetShakeService() { + } + + @Test + public void testGetMemberCardService() { + } + + @Test + public void testGetRequestHttp() { + } + + @Test + public void testGetMassMessageService() { + } + + @Test + public void testSetKefuService() { + } + + @Test + public void testSetMaterialService() { + } + + @Test + public void testSetMenuService() { + } + + @Test + public void testSetUserService() { + } + + @Test + public void testSetTagService() { + } + + @Test + public void testSetQrCodeService() { + } + + @Test + public void testSetCardService() { + } + + @Test + public void testSetStoreService() { + } + + @Test + public void testSetDataCubeService() { + } + + @Test + public void testSetBlackListService() { + } + + @Test + public void testSetTemplateMsgService() { + } + + @Test + public void testSetDeviceService() { + } + + @Test + public void testSetShakeService() { + } + + @Test + public void testSetMemberCardService() { + } + + @Test + public void testSetMassMessageService() { + } + + @Test + public void testGetAiOpenService() { + } + + @Test + public void testSetAiOpenService() { + } + + @Test + public void testGetWifiService() { + } + + @Test + public void testGetOcrService() { + } + + @Test + public void testGetMarketingService() { + } + + @Test + public void testSetMarketingService() { + } + + @Test + public void testSetOcrService() { + } + + @Test + public void testGetCommentService() { + } + + @Test + public void testSetCommentService() { + } + + @Test + public void testGetImgProcService() { + } + + @Test + public void testSetImgProcService() { + } }