From e3f785f0065b9e3b4e5127a8d69b7f65f560ae96 Mon Sep 17 00:00:00 2001 From: ParkerJX Date: Sat, 26 Jun 2021 21:08:48 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20#2171=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=94?= =?UTF-8?q?=E7=94=A8CORP=5FJSAPI=5FTICKET=20,SUITE=5FJSAPI=5FTICKET=20=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=20ticket=20=E5=A4=B1=E6=95=88=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/tp/service/WxCpTpService.java | 11 +++++++++++ .../cp/tp/service/impl/BaseWxCpTpServiceImpl.java | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java index 60f937122..bd44911fe 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java @@ -255,6 +255,17 @@ public interface WxCpTpService { */ String get(String url, String queryParam) throws WxErrorException; + /** + * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求. + * + * @param url 接口地址 + * @param queryParam 请求参数 + * @param withoutSuiteAccessToken 请求是否忽略SuiteAccessToken 默认不忽略-false + * @return the string + * @throws WxErrorException the wx error exception + */ + String get(String url, String queryParam, boolean withoutSuiteAccessToken) throws WxErrorException; + /** * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求. * diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java index f681679b9..89903d6f0 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java @@ -146,7 +146,7 @@ public abstract class BaseWxCpTpServiceImpl implements WxCpTpService, Requ if (this.configStorage.isAuthSuiteJsApiTicketExpired(authCorpId)) { String resp = get(configStorage.getApiUrl(GET_SUITE_JSAPI_TICKET), - "type=agent_config&access_token=" + this.configStorage.getAccessToken(authCorpId)); + "type=agent_config&access_token=" + this.configStorage.getAccessToken(authCorpId), true); JsonObject jsonObject = GsonParser.parse(resp); if (jsonObject.get("errcode").getAsInt() == 0) { @@ -176,7 +176,7 @@ public abstract class BaseWxCpTpServiceImpl implements WxCpTpService, Requ if (this.configStorage.isAuthCorpJsApiTicketExpired(authCorpId)) { String resp = get(configStorage.getApiUrl(GET_AUTH_CORP_JSAPI_TICKET), - "access_token=" + this.configStorage.getAccessToken(authCorpId)); + "access_token=" + this.configStorage.getAccessToken(authCorpId), true); JsonObject jsonObject = GsonParser.parse(resp); if (jsonObject.get("errcode").getAsInt() == 0) { @@ -303,6 +303,11 @@ public abstract class BaseWxCpTpServiceImpl implements WxCpTpService, Requ return execute(SimpleGetRequestExecutor.create(this), url, queryParam); } + @Override + public String get(String url, String queryParam, boolean withoutSuiteAccessToken) throws WxErrorException { + return execute(SimpleGetRequestExecutor.create(this), url, queryParam, withoutSuiteAccessToken); + } + @Override public String post(String url, String postData) throws WxErrorException { return execute(SimplePostRequestExecutor.create(this), url, postData,false);