Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【企业微信】第三方应用CORP_JSAPI_TICKET ,SUITE_JSAPI_TICKET 获取 ticket 失效修复 #2171

Merged
merged 5 commits into from
Jun 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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请求.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down