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 60f937122a..bd44911feb 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 f681679b90..89903d6f00 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 String getSuiteJsApiTicket(String authCorpId) throws WxErrorException { 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 String getAuthCorpJsApiTicket(String authCorpId) throws WxErrorException 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 String get(String url, String queryParam) throws WxErrorException { 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);