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, "手机号格式错误");