Skip to content

Commit

Permalink
⬆️ 升级sdk版本为4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Nov 30, 2020
1 parent ea03d1d commit 46daf28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 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.9.0</weixin-java-mp.version>
<weixin-java-mp.version>4.0.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
@@ -1,9 +1,10 @@
package com.github.binarywang.demo.wx.mp.controller;

import lombok.AllArgsConstructor;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
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.stereotype.Controller;
import org.springframework.ui.ModelMap;
Expand All @@ -27,8 +28,8 @@ public String greetUser(@PathVariable String appid, @RequestParam String code, M
}

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

0 comments on commit 46daf28

Please sign in to comment.