去掉多余容易引起误解的测试使用的接口方法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;
/**
* <pre>
* 构造oauth2授权的url连接
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
* </pre>
*
* @return url
*/
String oauth2buildAuthorizationUrl(String scope, String state);
/**
* <pre>
* 构造oauth2授权的url连接

View File

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

View File

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