Skip to content

Commit e3f785f

Browse files
🐛 #2171【企业微信】第三方应用CORP_JSAPI_TICKET ,SUITE_JSAPI_TICKET 获取 ticket 失效修复
1 parent b6d4b5e commit e3f785f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java

+11
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ public interface WxCpTpService {
255255
*/
256256
String get(String url, String queryParam) throws WxErrorException;
257257

258+
/**
259+
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
260+
*
261+
* @param url 接口地址
262+
* @param queryParam 请求参数
263+
* @param withoutSuiteAccessToken 请求是否忽略SuiteAccessToken 默认不忽略-false
264+
* @return the string
265+
* @throws WxErrorException the wx error exception
266+
*/
267+
String get(String url, String queryParam, boolean withoutSuiteAccessToken) throws WxErrorException;
268+
258269
/**
259270
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
260271
*

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public String getSuiteJsApiTicket(String authCorpId) throws WxErrorException {
146146
if (this.configStorage.isAuthSuiteJsApiTicketExpired(authCorpId)) {
147147

148148
String resp = get(configStorage.getApiUrl(GET_SUITE_JSAPI_TICKET),
149-
"type=agent_config&access_token=" + this.configStorage.getAccessToken(authCorpId));
149+
"type=agent_config&access_token=" + this.configStorage.getAccessToken(authCorpId), true);
150150

151151
JsonObject jsonObject = GsonParser.parse(resp);
152152
if (jsonObject.get("errcode").getAsInt() == 0) {
@@ -176,7 +176,7 @@ public String getAuthCorpJsApiTicket(String authCorpId) throws WxErrorException
176176
if (this.configStorage.isAuthCorpJsApiTicketExpired(authCorpId)) {
177177

178178
String resp = get(configStorage.getApiUrl(GET_AUTH_CORP_JSAPI_TICKET),
179-
"access_token=" + this.configStorage.getAccessToken(authCorpId));
179+
"access_token=" + this.configStorage.getAccessToken(authCorpId), true);
180180

181181
JsonObject jsonObject = GsonParser.parse(resp);
182182
if (jsonObject.get("errcode").getAsInt() == 0) {
@@ -303,6 +303,11 @@ public String get(String url, String queryParam) throws WxErrorException {
303303
return execute(SimpleGetRequestExecutor.create(this), url, queryParam);
304304
}
305305

306+
@Override
307+
public String get(String url, String queryParam, boolean withoutSuiteAccessToken) throws WxErrorException {
308+
return execute(SimpleGetRequestExecutor.create(this), url, queryParam, withoutSuiteAccessToken);
309+
}
310+
306311
@Override
307312
public String post(String url, String postData) throws WxErrorException {
308313
return execute(SimplePostRequestExecutor.create(this), url, postData,false);

0 commit comments

Comments
 (0)