Skip to content

Commit

Permalink
⬆️ 升级sdk版本为3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Aug 24, 2020
1 parent 05d1ac1 commit a58e8a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<description>基于 WxJava 和 Spring Boot 实现的微信公众号后端开发演示项目</description>

<properties>
<weixin-java-mp.version>3.8.9.B</weixin-java-mp.version>
<weixin-java-mp.version>3.9.0</weixin-java-mp.version>

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
if (servletRequestAttributes != null) {
HttpServletRequest request = servletRequestAttributes.getRequest();
URL requestURL = new URL(request.getRequestURL().toString());
String url = this.wxService.switchoverTo(appid).oauth2buildAuthorizationUrl(
String url = this.wxService.switchoverTo(appid).getOAuth2Service().buildAuthorizationUrl(
String.format("%s://%s/wx/redirect/%s/greet", requestURL.getProtocol(), requestURL.getHost(), appid),
WxConsts.OAuth2Scope.SNSAPI_USERINFO, null);
button34.setUrl(url);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package com.github.binarywang.demo.wx.mp.controller;

import com.github.binarywang.demo.wx.mp.config.WxMpConfiguration;
import lombok.AllArgsConstructor;
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.mp.bean.result.WxMpUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.xml.ws.Action;

/**
* @author Edward
*/
Expand All @@ -31,8 +27,8 @@ public String greetUser(@PathVariable String appid, @RequestParam String code, M
}

try {
WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
WxMpUser user = wxService.oauth2getUserInfo(accessToken, null);
WxMpOAuth2AccessToken accessToken = wxService.getOAuth2Service().getAccessToken(code);
WxMpUser user = wxService.getOAuth2Service().getUserInfo(accessToken, null);
map.put("user", user);
} catch (WxErrorException e) {
e.printStackTrace();
Expand Down

0 comments on commit a58e8a0

Please sign in to comment.