浏览代码

🐛 #1276 修复微信开放平台获取授权列表接口token参数导致死循环的问题

WxOpenComponentServiceImpl#getAuthorizerList由post内部维护token,否则总是使用旧token导致死循环
master
qizai 5 年前
committed by Binary Wang
父节点
当前提交
2e14b5479e
共有 2 个文件被更改,包括 2 次插入5 次删除
  1. +1
    -1
      weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java
  2. +1
    -4
      weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java

+ 1
- 1
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java 查看文件

@@ -27,7 +27,7 @@ public interface WxOpenComponentService {
String API_GET_AUTHORIZER_INFO_URL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info";
String API_GET_AUTHORIZER_OPTION_URL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_option";
String API_SET_AUTHORIZER_OPTION_URL = "https://api.weixin.qq.com/cgi-bin/component/api_set_authorizer_option";
String API_GET_AUTHORIZER_LIST = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_list?component_access_token=%s";
String API_GET_AUTHORIZER_LIST = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_list";

String COMPONENT_LOGIN_PAGE_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=xxx&biz_appid=xxx";



+ 1
- 4
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java 查看文件

@@ -304,16 +304,13 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {

@Override
public WxOpenAuthorizerListResult getAuthorizerList(int begin, int len) throws WxErrorException {

String url = String.format(API_GET_AUTHORIZER_LIST, getComponentAccessToken(false));
begin = begin < 0 ? 0 : begin;
len = len == 0 ? 10 : len;

JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("component_appid", getWxOpenConfigStorage().getComponentAppId());
jsonObject.addProperty("offset", begin);
jsonObject.addProperty("count", len);
String responseContent = post(url, jsonObject.toString());
String responseContent = post(API_GET_AUTHORIZER_LIST, jsonObject.toString());
WxOpenAuthorizerListResult ret = WxOpenGsonBuilder.create().fromJson(responseContent, WxOpenAuthorizerListResult.class);
if (ret != null && ret.getList() != null) {
for (Map<String, String> data : ret.getList()) {


正在加载...
取消
保存