From cf4b1098ee18461ee73ab14937fe783068c3882c Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Wed, 12 Mar 2025 19:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E5=86=99=E7=9C=9F?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E7=89=B9=E6=AE=8A=E4=BA=A7=E5=93=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cultural/heritage/controller/user/UserController.java | 5 +++++ .../cultural/heritage/service/user/impl/UserServiceImpl.java | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cultural/heritage/controller/user/UserController.java b/src/main/java/com/cultural/heritage/controller/user/UserController.java index 4e72f07..c14d27d 100644 --- a/src/main/java/com/cultural/heritage/controller/user/UserController.java +++ b/src/main/java/com/cultural/heritage/controller/user/UserController.java @@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.util.DigestUtils; import org.springframework.web.bind.annotation.*; @@ -53,6 +54,10 @@ public class UserController { private WxOpenConfig wxOpenConfig; + @Resource + private RedisTemplate redisTemplate; + + /** * 用户登录 * @param userLoginRequest 用户登录请求体 diff --git a/src/main/java/com/cultural/heritage/service/user/impl/UserServiceImpl.java b/src/main/java/com/cultural/heritage/service/user/impl/UserServiceImpl.java index a2b4b13..a66dfd4 100644 --- a/src/main/java/com/cultural/heritage/service/user/impl/UserServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/user/impl/UserServiceImpl.java @@ -83,7 +83,6 @@ public class UserServiceImpl extends ServiceImpl implements Us @Override public void validUser(User user, boolean update) { - String userAccount = user.getUserAccount(); String userPassword = user.getUserPassword(); String userName = user.getUserName(); String userAvatar = user.getUserAvatar(); @@ -91,7 +90,7 @@ public class UserServiceImpl extends ServiceImpl implements Us String userRole = user.getUserRole(); Long id = user.getId(); ThrowUtils.throwIf(update && id == null, ErrorCode.OPERATION_ERROR, "id字段为null"); - if (StringUtils.isAnyBlank(userAccount, userPassword, userName, userAvatar, phone, userRole)) { + if (StringUtils.isAnyBlank(userPassword, userName, userAvatar, phone, userRole)) { throw new BusinessException(ErrorCode.PARAMS_ERROR, "存在参数为空"); } ThrowUtils.throwIf(!RegexUtils.isPhoneInvalid(phone), ErrorCode.OPERATION_ERROR, "手机号格式错误");