Skip to content

Commit 977161c

Browse files
committed
去掉多余容易引起误解的测试使用的接口方法oauth2buildAuthorizationUrl
1 parent 27ad02d commit 977161c

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,6 @@ public interface WxMpService {
152152
*/
153153
WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException;
154154

155-
/**
156-
* <pre>
157-
* 构造oauth2授权的url连接
158-
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
159-
* </pre>
160-
*
161-
* @return url
162-
*/
163-
String oauth2buildAuthorizationUrl(String scope, String state);
164-
165155
/**
166156
* <pre>
167157
* 构造oauth2授权的url连接

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) th
238238
return WxMpSemanticQueryResult.fromJson(responseContent);
239239
}
240240

241-
@Override
242-
public String oauth2buildAuthorizationUrl(String scope, String state) {
243-
return this.oauth2buildAuthorizationUrl(this.wxMpConfigStorage.getOauth2redirectUri(), scope, state);
244-
}
245-
246241
@Override
247242
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state) {
248243
StringBuilder url = new StringBuilder();

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoOAuth2Handler.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
*/
1515
public class DemoOAuth2Handler implements WxMpMessageHandler {
1616
@Override
17-
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context,
18-
WxMpService wxMpService, WxSessionManager sessionManager) {
19-
String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(WxConsts.OAUTH2_SCOPE_USER_INFO, null)
20-
+ "\">测试oauth2</a>";
21-
return WxMpXmlOutMessage
22-
.TEXT()
23-
.content(href)
24-
.fromUser(wxMessage.getToUserName())
25-
.toUser(wxMessage.getFromUserName()).build();
17+
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
18+
Map<String, Object> context, WxMpService wxMpService,
19+
WxSessionManager sessionManager) {
20+
String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(
21+
wxMpService.getWxMpConfigStorage().getOauth2redirectUri(),
22+
WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2</a>";
23+
return WxMpXmlOutMessage.TEXT().content(href)
24+
.fromUser(wxMessage.getToUserName()).toUser(wxMessage.getFromUserName())
25+
.build();
2626
}
2727
}

0 commit comments

Comments
 (0)