From 4c4dc127cdc9c41f2bfb3c138108529856e031b8 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 07 八月 2025 16:55:23 +0800 Subject: [PATCH] 提交基础版本 --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java index 8e80ece..a5a9949 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java @@ -143,8 +143,8 @@ if (passwordTrueFlag) { String token = JwtTokenUtil.generateToken(phone); String key = token; - if(token.length() > 16){ - key = token.substring(token.length() - 16); + if(token.length() > 32){ + key = token.substring(token.length() - 32); } redisUtil.setStrValue(key, appUser.getId().toString(), 94608000); redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 94608000); @@ -517,16 +517,38 @@ ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = servletRequestAttributes.getRequest(); String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); + String custom = request.getHeader("custom-header"); if (ToolUtil.isNotEmpty(requestHeader) && requestHeader.startsWith("Bearer ")) { requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); String key = null; int length = requestHeader.length(); - if(length > 16){ - key = requestHeader.substring(length - 16); + if(length > 32){ + key = requestHeader.substring(length - 32); }else{ key = requestHeader; } String value = redisUtil.getValue(key); + //从打车系统直接带过来的token + if(ToolUtil.isNotEmpty(custom) && "1".equals(custom)){ + AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("taxiUserId", value)); + if(null != appUser){ + value = appUser.getId().toString(); + }else{ + String userPhone = AppUserUtil.getUserPhone(Integer.valueOf(value)); + //创建新的用户 + appUser = new AppUser(); + appUser.setNickname("亲爱的用户"); + appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/9af2cadb5d0d42d5b9da37f0c6789a66.png"); + appUser.setPhone(userPhone); + appUser.setAccountBalance(0D); + appUser.setStatus(1); + appUser.setCreateTime(new Date()); + appUser.setIsException(1); + appUser.setTaxiUserId(Integer.valueOf(value)); + this.insert(appUser); + } + } + return null != value ? Integer.valueOf(value) : null; }else{ return null; -- Gitblit v1.7.1