1.change default nick name

main
Gary 10 months ago
parent cbac8c653f
commit 52dbe96167

@ -120,7 +120,7 @@ public class UserController {
public Result<UserRespDTO> touristLogin() { public Result<UserRespDTO> touristLogin() {
UserRespDTO userRespDTO=new UserRespDTO(); UserRespDTO userRespDTO=new UserRespDTO();
userRespDTO.setId(String.valueOf(idWorker.nextId())); userRespDTO.setId(String.valueOf(idWorker.nextId()));
userRespDTO.setNickname("游客"+NickNameUtil.getRandomNickName()); userRespDTO.setNickname("游客-"+NickNameUtil.getRandomNickName());
String token = jwtUtil.createJWT(userRespDTO.getId(),"tourist","tourist"); String token = jwtUtil.createJWT(userRespDTO.getId(),"tourist","tourist");
userRespDTO.setToken(token); userRespDTO.setToken(token);
return Result.success(userRespDTO); return Result.success(userRespDTO);

@ -6,7 +6,7 @@ import lombok.Data;
public class UserRespDTO { public class UserRespDTO {
@ApiModelProperty(value = "ID") @ApiModelProperty(value = "ID")
private String id;//ID private String id;//ID
@ApiModelProperty(value = "昵称,首次注册登录,登录用户随机为“雀乐XXX”游客为“游客XXX”",example="雀乐XXX") @ApiModelProperty(value = "昵称,首次注册登录,登录用户随机为“雀乐-XXX”游客为“游客-XXX”, XXX 为2~4位中文昵称",example="雀乐-XXX")
private String nickname;//昵称 private String nickname;//昵称
@ApiModelProperty(value = "性别0为男1 为女,首次注册登录,留空不显示",example="0") @ApiModelProperty(value = "性别0为男1 为女,首次注册登录,留空不显示",example="0")
private String sex;//性别 private String sex;//性别

@ -269,7 +269,7 @@ public class UserService {
user = new User(); user = new User();
user.setId(String.valueOf(idWorker.nextId())); user.setId(String.valueOf(idWorker.nextId()));
user.setMobile(mobile); user.setMobile(mobile);
user.setNickname("雀乐" + NickNameUtil.getRandomNickName()); user.setNickname("雀乐-" + NickNameUtil.getRandomNickName());
userDao.save(user); userDao.save(user);
} else { } else {
user.setLastdate(new Date()); user.setLastdate(new Date());

@ -4,10 +4,6 @@ import com.apifan.common.random.RandomSource;
public class NickNameUtil { public class NickNameUtil {
public static String getRandomNickName() { public static String getRandomNickName() {
String rawNickName=RandomSource.personInfoSource().randomChineseNickName(3); return RandomSource.personInfoSource().randomChineseNickName(4);
if(rawNickName.length()>3) {
return rawNickName.substring(0, 3);
}
return rawNickName;
} }
} }

Loading…
Cancel
Save