Skip to content

Commit a58e8a0

Browse files
committed
⬆️ 升级sdk版本为3.9.0
1 parent 05d1ac1 commit a58e8a0

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<description>基于 WxJava 和 Spring Boot 实现的微信公众号后端开发演示项目</description>
1919

2020
<properties>
21-
<weixin-java-mp.version>3.8.9.B</weixin-java-mp.version>
21+
<weixin-java-mp.version>3.9.0</weixin-java-mp.version>
2222

2323
<maven.compiler.source>1.8</maven.compiler.source>
2424
<maven.compiler.target>1.8</maven.compiler.target>

src/main/java/com/github/binarywang/demo/wx/mp/controller/WxMenuController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
8888
if (servletRequestAttributes != null) {
8989
HttpServletRequest request = servletRequestAttributes.getRequest();
9090
URL requestURL = new URL(request.getRequestURL().toString());
91-
String url = this.wxService.switchoverTo(appid).oauth2buildAuthorizationUrl(
91+
String url = this.wxService.switchoverTo(appid).getOAuth2Service().buildAuthorizationUrl(
9292
String.format("%s://%s/wx/redirect/%s/greet", requestURL.getProtocol(), requestURL.getHost(), appid),
9393
WxConsts.OAuth2Scope.SNSAPI_USERINFO, null);
9494
button34.setUrl(url);

src/main/java/com/github/binarywang/demo/wx/mp/controller/WxRedirectController.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
package com.github.binarywang.demo.wx.mp.controller;
22

3-
import com.github.binarywang.demo.wx.mp.config.WxMpConfiguration;
43
import lombok.AllArgsConstructor;
54
import me.chanjar.weixin.common.error.WxErrorException;
65
import me.chanjar.weixin.mp.api.WxMpService;
76
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
87
import me.chanjar.weixin.mp.bean.result.WxMpUser;
9-
import org.springframework.beans.factory.annotation.Autowired;
108
import org.springframework.stereotype.Controller;
119
import org.springframework.ui.ModelMap;
1210
import org.springframework.web.bind.annotation.PathVariable;
1311
import org.springframework.web.bind.annotation.RequestMapping;
1412
import org.springframework.web.bind.annotation.RequestParam;
1513

16-
import javax.xml.ws.Action;
17-
1814
/**
1915
* @author Edward
2016
*/
@@ -31,8 +27,8 @@ public String greetUser(@PathVariable String appid, @RequestParam String code, M
3127
}
3228

3329
try {
34-
WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
35-
WxMpUser user = wxService.oauth2getUserInfo(accessToken, null);
30+
WxMpOAuth2AccessToken accessToken = wxService.getOAuth2Service().getAccessToken(code);
31+
WxMpUser user = wxService.getOAuth2Service().getUserInfo(accessToken, null);
3632
map.put("user", user);
3733
} catch (WxErrorException e) {
3834
e.printStackTrace();

0 commit comments

Comments
 (0)