From 127dd794d07e03192d3de33da55954a4f90e005d Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 19 Jun 2024 11:36:19 +0800 Subject: [PATCH] =?UTF-8?q?1.=20app=E7=99=BB=E5=BD=95=E6=97=B6=E7=94=A8ope?= =?UTF-8?q?nid=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/framework/web/service/SysLoginService.java | 4 ++-- .../ruoyi/framework/web/service/UserDetailsServiceImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 39a02cd..25d57e9 100644 --- a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -252,7 +252,7 @@ public class SysLoginService } Authentication authentication = null; // 用户验证 try { - UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), Constants.CUSTOM_LOGIN_WX); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getWxopenid(), Constants.CUSTOM_LOGIN_WX); // 用户名和密码等信息保存在一个上下文中,只要是同一线程等会就能拿到用户名和密码,也就是能在loadUserByUsername(String username)方法中进行密码验证等 AuthenticationContextHolder.setContext(authenticationToken); // 把用户类型放在上下文中的details属性中,在UserDetailsServiceImpl.loadUserByUsername中获取 @@ -305,7 +305,7 @@ public class SysLoginService } Authentication authentication = null; // 用户验证 try { - UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), Constants.CUSTOM_LOGIN_WX); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getWxopenid(), Constants.CUSTOM_LOGIN_WX); // 用户名和密码等信息保存在一个上下文中,只要是同一线程等会就能拿到用户名和密码,也就是能在loadUserByUsername(String username)方法中进行密码验证等 AuthenticationContextHolder.setContext(authenticationToken); // 把用户类型放在上下文中的details属性中,在UserDetailsServiceImpl.loadUserByUsername中获取 diff --git a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java index aaed295..cfc5a8e 100644 --- a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java +++ b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java @@ -74,8 +74,8 @@ public class UserDetailsServiceImpl implements UserDetailsService return createLoginUser(user); }else { - // app用户登录 - AsUser user = asUserService.selectUserByUserName(username); + // app用户登录 如果是app用户则用openid查询 + AsUser user = asUserService.selectUserByWxopenid(username); if (StringUtils.isNull(user)) { log.info("登录用户:{} 不存在.", username);