修复已知问题

master
胡锐 1 month ago
parent 0a8d91d374
commit 1642b2ede8
  1. 21
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java

@ -130,12 +130,13 @@ public class BsUserServiceImpl implements BsUserService {
if (user.getInviteUserId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定过邀请人");
}
if (getUser(inviteUseId) == null) {
BsUser inviteUser = getUser(inviteUseId);
if (inviteUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的邀请人Id");
}
BsUserParentRel userParentRel = new BsUserParentRel();
userParentRel.setParentUserId(userParentRel.getParentUserId());
userParentRel.setParentUserGrade(userParentRel.getParentUserGrade());
userParentRel.setParentUserId(inviteUser.getId());
userParentRel.setParentUserGrade(inviteUser.getGrade());
userParentRel.setUserId(userId);
userParentRelService.editData(userParentRel);
@ -340,7 +341,7 @@ public class BsUserServiceImpl implements BsUserService {
// 校验邀请码
BsUserInviteCode userInviteCode = userInviteCodeService.getDetail(inviteUseId);
if (userInviteCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的邀请");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的邀请人Id");
}
user.setInviteUserId(userInviteCode.getUserId());
}
@ -356,6 +357,18 @@ public class BsUserServiceImpl implements BsUserService {
user.setStatus(UserStatusEnum.status1.getCode());
editData(user);
if (user.getInviteUserId() != null) {
BsUser inviteUser = getUser(inviteUseId);
if (inviteUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的邀请人Id");
}
BsUserParentRel userParentRel = new BsUserParentRel();
userParentRel.setParentUserId(inviteUser.getId());
userParentRel.setParentUserGrade(inviteUser.getGrade());
userParentRel.setUserId(user.getId());
userParentRelService.editData(userParentRel);
}
// 创建账户
userAccountService.create(user.getId());
return user;

Loading…
Cancel
Save