8000 fix javadoc · devandroid/weixin-java-tools@e86adc1 · GitHub
[go: up one dir, main page]

Skip to content

Commit e86adc1

Browse files
committed
fix javadoc
1 parent 2c2ed5d commit e86adc1

File tree

5 files changed

+112
-101
lines changed

5 files changed

+112
-101
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
public interface WxMaService {
1414
/**
15-
* 获取access_token
15+
* 获取access_token.
1616
*/
1717
String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
1818

@@ -25,22 +25,22 @@ public interface WxMaService {
2525
WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxErrorException;
2626
/**
2727
* <pre>
28-
* 验证消息的确来自微信服务器
28+
* 验证消息的确来自微信服务器.
2929
* 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
3030
* </pre>
3131
*/
3232
boolean checkSignature(String timestamp, String nonce, String signature);
3333

3434
/**
35-
* 获取access_token, 不强制刷新access_token
35+
* 获取access_token, 不强制刷新access_token.
3636
*
3737
* @see #getAccessToken(boolean)
3838
*/
3939
String getAccessToken() throws WxErrorException;
4040

4141
/**
4242
* <pre>
43-
* 获取access_token,本方法线程安全
43+
* 获取access_token,本方法线程安全.
4444
* 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
4545
*
4646
* 另:本service的所有方法都会在access_token过期是调用此方法
@@ -55,12 +55,12 @@ public interface WxMaService {
5555
String getAccessToken(boolean forceRefresh) throws WxErrorException;
5656

5757
/**
58-
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
58+
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
5959
*/
6060
String get(String url, String queryParam) throws WxErrorException;
6161

6262
/**
63-
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求
63+
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
6464
*/
6565
String post(String url, String postData) throws WxErrorException;
6666

@@ -75,73 +75,73 @@ public interface WxMaService {
7575

7676
/**
7777
* <pre>
78-
* 设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试
78+
* 设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
7979
* 默认:1000ms
8080
* </pre>
8181
*/
8282
void setRetrySleepMillis(int retrySleepMillis);
8383

8484
/**
8585
* <pre>
86-
* 设置当微信系统响应系统繁忙时,最大重试次数
86+
* 设置当微信系统响应系统繁忙时,最大重试次数.
8787
* 默认:5次
8888
* </pre>
8989
*/
9090
void setMaxRetryTimes(int maxRetryTimes);
9191

9292
/**
93-
* 获取WxMaConfig 对象
93+
* 获取WxMaConfig 对象.
9494
*
9595
* @return WxMaConfig
9696
*/
9797
WxMaConfig getWxMaConfig();
9898

9999
/**
100-
* 注入 {@link WxMaConfig} 的实现
100+
* 注入 {@link WxMaConfig} 的实现.
101101
*/
102102
void setWxMaConfig(WxMaConfig wxConfigProvider);
103103

104104
/**
105-
* 返回消息(客服消息和模版消息)发送接口方法实现类,以方便调用其各个接口
105+
* 返回消息(客服消息和模版消息)发送接口方法实现类,以方便调用其各个接口.
106106
*
107107
* @return WxMaMsgService
108108
*/
109109
WxMaMsgService getMsgService();
110110

111111
/**
112-
* 返回素材相关接口方法的实现类对象,以方便调用其各个接口
112+
* 返回素材相关接口方法的实现类对象,以方便调用其各个接口.
113113
*
114114
* @return WxMaMediaService
115115
*/
116116
WxMaMediaService getMediaService();
117117

118118
/**
119-
* 返回用户相关接口方法的实现类对象,以方便调用其各个接口
119+
* 返回用户相关接口方法的实现类对象,以方便调用其各个接口.
120120
*
121121
* @return WxMaUserService
122122
*/
123123
WxMaUserService getUserService();
124124

125125
/**
126-
* 返回二维码相关接口方法的实现类对象,以方便调用其各个接口
126+
* 返回二维码相关接口方法的实现类对象,以方便调用其各个接口.
127127
*
128128
* @return WxMaQrcodeService
129129
*/
130130
WxMaQrcodeService getQrcodeService();
131131

132132
/**
133-
* 返回模板配置相关接口方法的实现类对象, 以方便调用其各个接口
133+
* 返回模板配置相关接口方法的实现类对象, 以方便调用其各个接口.
134134
* @return WxMaTemplateService
135135
*/
136136
WxMaTemplateService getTemplateService();
137137

138138
/**
139-
* 初始化http请求对象
139+
* 初始化http请求对象.
140140
*/
141141
void initHttp();
142142

143143
/**
144-
* 请求http请求相关信息
144+
* 请求http请求相关信息.
145145
*/
146146
RequestHttp getRequestHttp();
147147

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaUserService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
import me.chanjar.weixin.common.exception.WxErrorException;
66

77
/**
8-
* 用户信息相关操作接口
8+
* 用户信息相关操作接口.
99
*
1010
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1111
*/
1212
public interface WxMaUserService {
1313

1414
/**
15-
* 获取登录后的session信息
15+
* 获取登录后的session信息.
1616
*
1717
* @param jsCode 登录时获取的 code
1818
*/
1919
WxMaJscode2SessionResult getSessionInfo(String jsCode) throws WxErrorException;
2020

2121
/**
22-
* 解密用户敏感数据
22+
* 解密用户敏感数据.
2323
*
2424
* @param sessionKey 会话密钥
2525
* @param encryptedData 消息密文
@@ -28,7 +28,7 @@ public interface WxMaUserService {
2828
WxMaUserInfo getUserInfo(String sessionKey, String encryptedData, String ivStr);
2929

3030
/**
31-
* 验证用户信息完整性
31+
* 验证用户信息完整性.
3232
*
3333
* @param sessionKey 会话密钥
3434
* @param rawData 微信用户基本信息

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
11
package cn.binarywang.wx.miniapp.api.impl;
22

3-
import cn.binarywang.wx.miniapp.api.*;
3+
import java.io.IOException;
4+
import java.util.HashMap;
5+
import java.util.Map;
6+
import java.util.concurrent.locks.Lock;
7+
8+
import org.apache.http.HttpHost;
9+
import org.apache.http.client.config.RequestConfig;
10+
import org.apache.http.client.methods.CloseableHttpResponse;
11+
import org.apache.http.client.methods.HttpGet;
12+
import org.apache.http.impl.client.BasicResponseHandler;
13+
import org.apache.http.impl.client.CloseableHttpClient;
14+
import org.slf4j.Logger;
15+
import org.slf4j.LoggerFactory;
16+
17+
import cn.binarywang.wx.miniapp.api.WxMaMediaService;
18+
import cn.binarywang.wx.miniapp.api.WxMaMsgService;
19+
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
20+
import cn.binarywang.wx.miniapp.api.WxMaService;
21+
import cn.binarywang.wx.miniapp.api.WxMaTemplateService;
22+
import cn.binarywang.wx.miniapp.api.WxMaUserService;
423
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
524
import cn.binarywang.wx.miniapp.config.WxMaConfig;
625
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
726
import com.google.common.base.Joiner;
8-
import com.google.gson.JsonParser;
927
import me.chanjar.weixin.common.bean.WxAccessToken;
1028
import me.chanjar.weixin.common.bean.result.WxError;
1129
import me.chanjar.weixin.common.exception.WxErrorException;
1230
import me.chanjar.weixin.common.util.crypto.SHA1;
13-
import me.chanjar.weixin.common.util.http.*;
31+
import me.chanjar.weixin.common.util.http.HttpType;
32+
import me.chanjar.weixin.common.util.http.RequestExecutor;
33+
import me.chanjar.weixin.common.util.http.RequestHttp;
34+
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
35+
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
1436
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
1537
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
16-
import org.apache.http.HttpHost;
17-
import org.apache.http.client.config.RequestConfig;
18-
import org.apache.http.client.methods.CloseableHttpResponse;
19-
import org.apache.http.client.methods.HttpGet;
20-
import org.apache.http.impl.client.BasicResponseHandler;
21-
import org.apache.http.impl.client.CloseableHttpClient;
22-
import org.slf4j.Logger;
23-
import org.slf4j.LoggerFactory;
24-
25-
import java.io.IOException;
26-
import java.util.HashMap;
27-
import java.util.Map;
28-
import java.util.concurrent.locks.Lock;
2938

3039
/**
3140
* @author <a href="https://github.com/binarywang">Binary Wang</a>
3241
*/
3342
public class WxMaServiceImpl implements WxMaService, RequestHttp<CloseableHttpClient, HttpHost> {
34-
private static final JsonParser JSON_PARSER = new JsonParser();
3543
private final Logger log = LoggerFactory.getLogger(this.getClass());
3644

3745
private CloseableHttpClient httpClient;
@@ -137,6 +145,7 @@ public WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxError
137145
String result = get(JSCODE_TO_SESSION_URL, Joiner.on("&").withKeyValueSeparator("=").join(params));
138146
return WxMaJscode2SessionResult.fromJson(result);
139147
}
148+
140149
@Override
141150
public boolean checkSignature(String timestamp, String nonce, String signature) {
142151
try {

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaUserServiceImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package cn.binarywang.wx.miniapp.api.impl;
22

3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
import org.apache.commons.codec.digest.DigestUtils;
7+
38
import cn.binarywang.wx.miniapp.api.WxMaService;
49
import cn.binarywang.wx.miniapp.api.WxMaUserService;
510
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
@@ -8,10 +13,6 @@
813
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
914
import com.google.common.base.Joiner;
1015
import me.chanjar.weixin.common.exception.WxErrorException;
11-
import org.apache.commons.codec.digest.DigestUtils;
12-
13-
import java.util.HashMap;
14-
import java.util.Map;
1516

1617
/**
1718
* @author <a href="https://github.com/binarywang">Binary Wang</a>

0 commit comments

Comments
 (0)
0