🎨 优化部分代码,重构OAuth2网页授权、网页登录等相关接口,方便接入open模块
This commit is contained in:
@@ -3,7 +3,7 @@ package me.chanjar.weixin.open.api;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.open.bean.WxOpenCreateResult;
|
||||
import me.chanjar.weixin.open.bean.WxOpenGetResult;
|
||||
import me.chanjar.weixin.open.bean.WxOpenMaCodeTemplate;
|
||||
@@ -332,7 +332,7 @@ public interface WxOpenComponentService {
|
||||
* @return the wx mp o auth 2 access token
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxMpOAuth2AccessToken oauth2getAccessToken(String appid, String code) throws WxErrorException;
|
||||
WxOAuth2AccessToken oauth2getAccessToken(String appid, String code) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* Check signature boolean.
|
||||
@@ -353,7 +353,7 @@ public interface WxOpenComponentService {
|
||||
* @return the wx mp o auth 2 access token
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxMpOAuth2AccessToken oauth2refreshAccessToken(String appid, String refreshToken) throws WxErrorException;
|
||||
WxOAuth2AccessToken oauth2refreshAccessToken(String appid, String refreshToken) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* Oauth 2 build authorization url string.
|
||||
|
||||
@@ -14,7 +14,7 @@ import me.chanjar.weixin.common.util.http.URIUtil;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.open.api.*;
|
||||
import me.chanjar.weixin.open.bean.*;
|
||||
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
|
||||
@@ -394,10 +394,10 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpOAuth2AccessToken oauth2getAccessToken(String appId, String code) throws WxErrorException {
|
||||
public WxOAuth2AccessToken oauth2getAccessToken(String appId, String code) throws WxErrorException {
|
||||
String url = String.format(OAUTH2_ACCESS_TOKEN_URL, appId, code, getWxOpenConfigStorage().getComponentAppId());
|
||||
String responseContent = get(url);
|
||||
return WxMpOAuth2AccessToken.fromJson(responseContent);
|
||||
return WxOAuth2AccessToken.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -406,10 +406,10 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpOAuth2AccessToken oauth2refreshAccessToken(String appId, String refreshToken) throws WxErrorException {
|
||||
public WxOAuth2AccessToken oauth2refreshAccessToken(String appId, String refreshToken) throws WxErrorException {
|
||||
String url = String.format(OAUTH2_REFRESH_TOKEN_URL, appId, refreshToken, getWxOpenConfigStorage().getComponentAppId());
|
||||
String responseContent = get(url);
|
||||
return WxMpOAuth2AccessToken.fromJson(responseContent);
|
||||
return WxOAuth2AccessToken.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user