#513 修复开放平台小程序jscode2session 错误

This commit is contained in:
007gzs
2018-03-25 23:30:18 +08:00
committed by Binary Wang
parent 6faae7e2d8
commit 2c2ed5d60c
7 changed files with 36 additions and 13 deletions

View File

@ -85,6 +85,6 @@ public interface WxOpenComponentService {
String oauth2buildAuthorizationUrl(String appid, String redirectURI, String scope, String state);
WxMaJscode2SessionResult miniappJscode2Session(String appid, String jsCode, String appId) throws WxErrorException;
WxMaJscode2SessionResult miniappJscode2Session(String appId, String jsCode) throws WxErrorException;
}

View File

@ -239,7 +239,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
}
@Override
public WxMaJscode2SessionResult miniappJscode2Session(String appid, String jsCode, String appId) throws WxErrorException {
public WxMaJscode2SessionResult miniappJscode2Session(String appId, String jsCode) throws WxErrorException {
String url = String.format(MINIAPP_JSCODE_2_SESSION, appId, jsCode, getWxOpenConfigStorage().getComponentAppId());
String responseContent = get(url);
return WxMaJscode2SessionResult.fromJson(responseContent);

View File

@ -1,10 +1,15 @@
package me.chanjar.weixin.open.api.impl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import com.google.common.base.Joiner;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.open.api.WxOpenComponentService;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
@ -20,6 +25,10 @@ import me.chanjar.weixin.open.api.WxOpenComponentService;
initHttp();
}
@Override
public WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxErrorException {
return wxOpenComponentService.miniappJscode2Session(appId, jsCode);
}
@Override
public WxMaConfig getWxMaConfig() {
return wxMaConfig;