diff --git a/src/main/java/com/rymcu/forest/wx/mp/controller/WxRedirectController.java b/src/main/java/com/rymcu/forest/wx/mp/controller/WxRedirectController.java index 0395f65..2e0364c 100644 --- a/src/main/java/com/rymcu/forest/wx/mp/controller/WxRedirectController.java +++ b/src/main/java/com/rymcu/forest/wx/mp/controller/WxRedirectController.java @@ -1,10 +1,10 @@ package com.rymcu.forest.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; import org.springframework.web.bind.annotation.PathVariable; @@ -27,8 +27,8 @@ public class WxRedirectController { } 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(); diff --git a/src/main/java/com/rymcu/forest/wx/mp/controller/WxoAuthController.java b/src/main/java/com/rymcu/forest/wx/mp/controller/WxoAuthController.java index d302914..7e0ba87 100644 --- a/src/main/java/com/rymcu/forest/wx/mp/controller/WxoAuthController.java +++ b/src/main/java/com/rymcu/forest/wx/mp/controller/WxoAuthController.java @@ -4,10 +4,10 @@ import com.rymcu.forest.service.WxUserService; import com.rymcu.forest.util.ContextHolderUtils; import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.bean.WxJsapiSignature; +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.util.http.URIUtil; 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.Value; import org.springframework.stereotype.Controller; @@ -52,7 +52,7 @@ public class WxoAuthController { @GetMapping("getAccessToken") public String getAccessToken(@PathVariable String appId, @RequestParam(name = "code") String code, @RequestParam(name = "redirectUrl") String redirectUrl) throws Exception { wxMpService.switchoverTo(appId); - WxMpOAuth2AccessToken oAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken(code); + WxOAuth2AccessToken oAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken(code); boolean valid = wxMpService.getOAuth2Service().validateAccessToken(oAuth2AccessToken); if (!valid) { throw new Exception("无权限");