提交代码

dev_xd
姜玉琦 2024-10-13 16:17:41 +08:00
parent ea52f8e363
commit 5c1e1e427b
4 changed files with 13 additions and 13 deletions

View File

@ -35,8 +35,8 @@
<minio.version>8.2.2</minio.version> <minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<pinyin4j.version>2.5.1</pinyin4j.version> <pinyin4j.version>2.5.1</pinyin4j.version>
<weixin.mp.version>2.7.0</weixin.mp.version> <weixin.mp.version>4.0.6.B</weixin.mp.version>
<weixin.miniapp.version>4.5.5.B</weixin.miniapp.version> <weixin.miniapp.version>4.0.6.B</weixin.miniapp.version>
<transmittable-thread-local.version>2.14.2</transmittable-thread-local.version> <transmittable-thread-local.version>2.14.2</transmittable-thread-local.version>
</properties> </properties>

View File

@ -3,9 +3,9 @@ package com.yanzhu.manage.config;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; 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.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -29,7 +29,7 @@ public class WeChatConfig {
*/ */
@Bean @Bean
public WxMpService wxMpService() { public WxMpService wxMpService() {
WxMpInMemoryConfigStorage config = new WxMpInMemoryConfigStorage(); WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId()); log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId());
log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret()); log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret());
config.setAppId(weChatProperties.getMpAppId()); config.setAppId(weChatProperties.getMpAppId());
@ -47,14 +47,14 @@ public class WeChatConfig {
*/ */
@Bean @Bean
public WxMaService wxMaService() { public WxMaService wxMaService() {
WxMaDefaultConfigImpl wxMaConfig = new WxMaDefaultConfigImpl(); WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
log.info("weChatProperties.maAppId...{}",weChatProperties.getMaAppId()); log.info("weChatProperties.maAppId...{}",weChatProperties.getMaAppId());
log.info("weChatProperties.maAppSecret...{}",weChatProperties.getMaAppSecret()); log.info("weChatProperties.maAppSecret...{}",weChatProperties.getMaAppSecret());
wxMaConfig.setAppid(weChatProperties.getMaAppId()); config.setAppid(weChatProperties.getMaAppId());
wxMaConfig.setSecret(weChatProperties.getMaAppSecret()); config.setSecret(weChatProperties.getMaAppSecret());
WxMaService wxMaService = new WxMaServiceImpl(); WxMaService wxMaService = new WxMaServiceImpl();
wxMaService.setWxMaConfig(wxMaConfig); wxMaService.setWxMaConfig(config);
return wxMaService; return wxMaService;
} }

View File

@ -33,10 +33,10 @@ public class WxCallBackController {
@InnerAuth @InnerAuth
@GetMapping("/getMaOpenId/{code}") @GetMapping("/getMaOpenId/{code}")
public R<Map<String, Object>> getMaOpenId(@PathVariable("code") String code) { public R<Map<String, Object>> getMaOpenId(@PathVariable("code") String code) {
WxMaJscode2SessionResult sessionInfo =
wxMaService.getUserService().getSessionInfo(code);
log.info("getMaOpenId==>{}...{}",code,sessionInfo.getOpenid());
try { try {
WxMaJscode2SessionResult sessionInfo =
wxMaService.getUserService().getSessionInfo(code);
log.info("getMaOpenId==>{}...{}",code,sessionInfo.getOpenid());
return R.ok(BeanUtils.beanToMap(sessionInfo)); return R.ok(BeanUtils.beanToMap(sessionInfo));
}catch (Exception e){ }catch (Exception e){
return R.fail("小程序登录异常!!!"); return R.fail("小程序登录异常!!!");

View File

@ -3,9 +3,9 @@ package com.yanzhu.system.config;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; 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.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -29,7 +29,7 @@ public class WeChatConfig {
*/ */
@Bean @Bean
public WxMpService wxMpService() { public WxMpService wxMpService() {
WxMpInMemoryConfigStorage config = new WxMpInMemoryConfigStorage(); WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId()); log.info("weChatProperties.mpAppId...{}",weChatProperties.getMpAppId());
log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret()); log.info("weChatProperties.mpAppSecret...{}",weChatProperties.getMpAppSecret());
config.setAppId(weChatProperties.getMpAppId()); config.setAppId(weChatProperties.getMpAppId());