去掉多余容易引起误解的测试使用的接口方法oauth2buildAuthorizationUrl

This commit is contained in:
BinaryWang 2016-08-18 13:55:39 +08:00
parent 27ad02dd71
commit 977161cbeb
3 changed files with 9 additions and 24 deletions

View File

@ -152,16 +152,6 @@ public interface WxMpService {
*/ */
WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException; WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException;
/**
* <pre>
* 构造oauth2授权的url连接
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
* </pre>
*
* @return url
*/
String oauth2buildAuthorizationUrl(String scope, String state);
/** /**
* <pre> * <pre>
* 构造oauth2授权的url连接 * 构造oauth2授权的url连接

View File

@ -238,11 +238,6 @@ public class WxMpServiceImpl implements WxMpService {
return WxMpSemanticQueryResult.fromJson(responseContent); return WxMpSemanticQueryResult.fromJson(responseContent);
} }
@Override
public String oauth2buildAuthorizationUrl(String scope, String state) {
return this.oauth2buildAuthorizationUrl(this.wxMpConfigStorage.getOauth2redirectUri(), scope, state);
}
@Override @Override
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state) { public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state) {
StringBuilder url = new StringBuilder(); StringBuilder url = new StringBuilder();

View File

@ -14,14 +14,14 @@ import java.util.Map;
*/ */
public class DemoOAuth2Handler implements WxMpMessageHandler { public class DemoOAuth2Handler implements WxMpMessageHandler {
@Override @Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
WxMpService wxMpService, WxSessionManager sessionManager) { Map<String, Object> context, WxMpService wxMpService,
String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(WxConsts.OAUTH2_SCOPE_USER_INFO, null) WxSessionManager sessionManager) {
+ "\">测试oauth2</a>"; String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(
return WxMpXmlOutMessage wxMpService.getWxMpConfigStorage().getOauth2redirectUri(),
.TEXT() WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2</a>";
.content(href) return WxMpXmlOutMessage.TEXT().content(href)
.fromUser(wxMessage.getToUserName()) .fromUser(wxMessage.getToUserName()).toUser(wxMessage.getFromUserName())
.toUser(wxMessage.getFromUserName()).build(); .build();
} }
} }