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

WxMaJsapiServiceImpl 里面的getCardApiTicket方法返回值有bug #1415

Closed
Hmilyhyun opened this issue Feb 26, 2020 · 2 comments
Closed

WxMaJsapiServiceImpl 里面的getCardApiTicket方法返回值有bug #1415

Hmilyhyun opened this issue Feb 26, 2020 · 2 comments

Comments

@Hmilyhyun
Copy link

Hmilyhyun commented Feb 26, 2020

简要描述

WxMaJsapiServiceImpl 里面的getCardApiTicket方法返回值有bug

模块版本情况

  • WxJava 模块名: cn.binarywang.wx.miniapp.api.impl.WxMaJsapiServiceImpl
  • WxJava 版本号:3.60

详细描述

下面的代码最后return那一行,一顿操作更新了cardApiTicket,最后返回了jsApiTicket

另外,我发现小程序文档里好像没有cardApiTicket和jsApiTicket的概念,代码中用的获取链接也是公众号的获取链接,建议还是删掉这两个东西…………

@Override
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
  Lock lock = this.wxMaService.getWxMaConfig().getCardApiTicketLock();
  try {
    lock.lock();
    if (forceRefresh) {
      this.wxMaService.getWxMaConfig().expireCardApiTicket();
    }

    if (this.wxMaService.getWxMaConfig().isCardApiTicketExpired()) {
      String responseContent = this.wxMaService.get(GET_JSAPI_TICKET_URL + "?type=wx_card", null);
      JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent);
      JsonObject tmpJsonObject = tmpJsonElement.getAsJsonObject();
      String jsapiTicket = tmpJsonObject.get("ticket").getAsString();
      int expiresInSeconds = tmpJsonObject.get("expires_in").getAsInt();
      this.wxMaService.getWxMaConfig().updateCardApiTicket(jsapiTicket, expiresInSeconds);
    }
  } finally {
    lock.unlock();
  }
  return this.wxMaService.getWxMaConfig().getJsapiTicket();
}

日志

没有

@binarywang
Copy link
Owner

#672 jssdk是有的

#776 card的也是特意加上的

代码确实有问题,先修复了

@binarywang
Copy link
Owner

最新正式版3.7.0已修复错误代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants