From f0dd030657f64f02ba9591429bb49368e36e5718 Mon Sep 17 00:00:00 2001 From: ronger Date: Wed, 18 Nov 2020 15:56:43 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=94=A8=E6=88=B7=E6=98=B5=E7=A7=B0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96(=E5=8E=BB=E9=99=A4=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=AD=97=E7=AC=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rymcu/vertical/service/impl/UserServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java index 3a007ee..3efeabe 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java @@ -53,7 +53,7 @@ public class UserServiceImpl extends AbstractService implements UserServic } @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public Map register(String email, String password, String code) { Map map = new HashMap(2); map.put("message","验证码无效!"); @@ -88,6 +88,7 @@ public class UserServiceImpl extends AbstractService implements UserServic } private String checkNickname(String nickname) { + nickname = formatNickname(nickname); Integer result = userMapper.selectCountByNickName(nickname); if (result > 0) { StringBuilder stringBuilder = new StringBuilder(nickname); @@ -183,6 +184,7 @@ public class UserServiceImpl extends AbstractService implements UserServic @Transactional(rollbackFor = Exception.class) public Map updateUserInfo(UserInfoDTO user) { Map map = new HashMap(1); + user.setNickname(formatNickname(user.getNickname())); Integer number = userMapper.checkNicknameByIdUser(user.getIdUser(), user.getNickname()); if (number > 0) { map.put("message", "该昵称已使用!"); @@ -203,6 +205,10 @@ public class UserServiceImpl extends AbstractService implements UserServic return map; } + private String formatNickname(String nickname) { + return nickname.replaceAll(".", ""); + } + @Override public Map checkNickname(Integer idUser, String nickname) { Map map = new HashMap(1);