From 5c1e1e427bc5ef186f17e77fd4daf1f9b29f590f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Sun, 13 Oct 2024 16:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- .../java/com/yanzhu/manage/config/WeChatConfig.java | 12 ++++++------ .../manage/controller/WxCallBackController.java | 6 +++--- .../java/com/yanzhu/system/config/WeChatConfig.java | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 76d350af..810ba83a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,8 +35,8 @@ 8.2.2 4.1.2 2.5.1 - 2.7.0 - 4.5.5.B + 4.0.6.B + 4.0.6.B 2.14.2 diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java index 437b9811..da47a73d 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java @@ -3,9 +3,9 @@ package com.yanzhu.manage.config; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; -import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +29,7 @@ public class WeChatConfig { */ @Bean public WxMpService wxMpService() { - WxMpInMemoryConfigStorage config = new WxMpInMemoryConfigStorage(); + WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl(); log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId()); log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret()); config.setAppId(weChatProperties.getMpAppId()); @@ -47,14 +47,14 @@ public class WeChatConfig { */ @Bean public WxMaService wxMaService() { - WxMaDefaultConfigImpl wxMaConfig = new WxMaDefaultConfigImpl(); + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); log.info("weChatProperties.maAppId...{}",weChatProperties.getMaAppId()); log.info("weChatProperties.maAppSecret...{}",weChatProperties.getMaAppSecret()); - wxMaConfig.setAppid(weChatProperties.getMaAppId()); - wxMaConfig.setSecret(weChatProperties.getMaAppSecret()); + config.setAppid(weChatProperties.getMaAppId()); + config.setSecret(weChatProperties.getMaAppSecret()); WxMaService wxMaService = new WxMaServiceImpl(); - wxMaService.setWxMaConfig(wxMaConfig); + wxMaService.setWxMaConfig(config); return wxMaService; } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/WxCallBackController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/WxCallBackController.java index bcf19acc..8f821065 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/WxCallBackController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/WxCallBackController.java @@ -33,10 +33,10 @@ public class WxCallBackController { @InnerAuth @GetMapping("/getMaOpenId/{code}") public R> getMaOpenId(@PathVariable("code") String code) { - WxMaJscode2SessionResult sessionInfo = - wxMaService.getUserService().getSessionInfo(code); - log.info("getMaOpenId==>{}...{}",code,sessionInfo.getOpenid()); try { + WxMaJscode2SessionResult sessionInfo = + wxMaService.getUserService().getSessionInfo(code); + log.info("getMaOpenId==>{}...{}",code,sessionInfo.getOpenid()); return R.ok(BeanUtils.beanToMap(sessionInfo)); }catch (Exception e){ return R.fail("小程序登录异常!!!"); diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/config/WeChatConfig.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/config/WeChatConfig.java index e3c9207a..36dd469b 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/config/WeChatConfig.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/config/WeChatConfig.java @@ -3,9 +3,9 @@ package com.yanzhu.system.config; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; -import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +29,7 @@ public class WeChatConfig { */ @Bean public WxMpService wxMpService() { - WxMpInMemoryConfigStorage config = new WxMpInMemoryConfigStorage(); + WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl(); log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId()); log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret()); config.setAppId(weChatProperties.getMpAppId());