Browse Source

:art: 优化完善部分接口javadoc

Binary Wang 5 years ago
parent
commit
ef6e2dd6c0

+ 2 - 0
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConfigImpl.java

@@ -9,6 +9,8 @@ import redis.clients.jedis.JedisPool;
  * <pre>
  * 需要引入依赖<a href="https://github.com/abelaska/jedis-lock">jedis-lock</a>,才能使用该类。
  * </pre>
+ *
+ * @author <a href="https://github.com/winter4666">winter</a>
  */
 public class WxMaRedisConfigImpl extends AbstractWxMaRedisConfig {
 

+ 58 - 3
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
    * </pre>
+   *
+   * @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
    * </pre>
    *
-   * @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 {
    * </pre>
    *
    * @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 {
    * </pre>
    *
    * @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
    * </pre>
+   *
+   * @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=长链接转短链接接口
    * </pre>
+   *
+   * @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=语义理解
    * </pre>
+   *
+   * @param semanticQuery 查询条件
+   * @return 查询结果
+   * @throws WxErrorException .
    */
   WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException;
 
@@ -136,6 +167,8 @@ public interface WxMpService {
    * </pre>
    *
    * @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=网页授权获取用户基本信息
    * </pre>
+   *
+   * @param code code
+   * @return token对象
+   * @throws WxErrorException .
    */
   WxMpOAuth2AccessToken oauth2getAccessToken(String code) throws WxErrorException;
 
@@ -152,6 +189,10 @@ public interface WxMpService {
    * <pre>
    * 刷新oauth2的access token.
    * </pre>
+   *
+   * @param refreshToken 刷新token
+   * @return 新的token对象
+   * @throws WxErrorException .
    */
   WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken) throws WxErrorException;
 
@@ -160,7 +201,10 @@ public interface WxMpService {
    * 用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
    * </pre>
    *
-   * @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 {
    * <pre>
    * 验证oauth2的access token是否有效.
    * </pre>
+   *
+   * @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
    * </pre>
+   *
+   * @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 {
   /**
    * <pre>
    * 获取公众号的自动回复规则.
-   * 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
    * </pre>
+   *
+   * @return 公众号的自动回复规则
+   * @throws WxErrorException .
    */
   WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException;
 
@@ -524,6 +578,7 @@ public interface WxMpService {
 
   /**
    * 返回图像处理接口的实现类对象,以方便调用其各个接口.
+   *
    * @return WxMpImgProcService
    */
   WxMpImgProcService getImgProcService();

+ 1 - 0
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;
 /**
  * <pre>
  * 公众号的自动回复规则.
+ * 参考文档地址:https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Getting_Rules_for_Auto_Replies.html
  * Created by Binary Wang on 2017-7-8.
  * </pre>
  *

+ 296 - 0
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() {
+  }
 }