diff --git a/framework/src/main/java/cn/lili/common/utils/CommonUtil.java b/framework/src/main/java/cn/lili/common/utils/CommonUtil.java index 61e7ebe98..c764f895a 100644 --- a/framework/src/main/java/cn/lili/common/utils/CommonUtil.java +++ b/framework/src/main/java/cn/lili/common/utils/CommonUtil.java @@ -34,4 +34,11 @@ public static String getRandomNum() { return sb.toString(); } + /** + * 获取特定字符 + 6位随机数 + * @return + */ + public static String getSpecialStr(String value) { + return value + getRandomNum(); + } } diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java b/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java index b39565fc8..8027050a4 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java @@ -3,6 +3,7 @@ import cn.lili.common.enums.ClientTypeEnum; import cn.lili.common.security.sensitive.Sensitive; import cn.lili.common.security.sensitive.enums.SensitiveStrategy; +import cn.lili.common.utils.CommonUtil; import cn.lili.mybatis.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -101,7 +102,7 @@ public Member(String username, String password, String mobile) { this.username = username; this.password = password; this.mobile = mobile; - this.nickName = "临时昵称"; + this.nickName = CommonUtil.getSpecialStr("用户"); this.disabled = true; this.haveStore = false; this.sex = 0; diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java index 6be253512..c64773f88 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java @@ -241,7 +241,7 @@ private Member findMember(String userName) { public Member autoRegister(ConnectAuthUser authUser) { if (CharSequenceUtil.isEmpty(authUser.getNickname())) { - authUser.setNickname("临时昵称"); + authUser.setNickname(CommonUtil.getSpecialStr("用户")); } if (CharSequenceUtil.isEmpty(authUser.getAvatar())) { authUser.setAvatar("https://i.loli.net/2020/11/19/LyN6JF7zZRskdIe.png"); @@ -841,4 +841,5 @@ private void checkMember(String userName, String mobilePhone) { throw new ServiceException(ResultCode.USER_EXIST); } } + } \ No newline at end of file