Skip to content

Commit

Permalink
feat: 新增会员昵称默认规则
Browse files Browse the repository at this point in the history
  • Loading branch information
lele0626 committed Jan 4, 2024
1 parent 72482ee commit e2fff23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions framework/src/main/java/cn/lili/common/utils/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ public static String getRandomNum() {
return sb.toString();
}

/**
* 获取特定字符 + 6位随机数
* @return
*/
public static String getSpecialStr(String value) {
return value + getRandomNum();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -841,4 +841,5 @@ private void checkMember(String userName, String mobilePhone) {
throw new ServiceException(ResultCode.USER_EXIST);
}
}

}

0 comments on commit e2fff23

Please sign in to comment.