TASK:AiDA

This commit is contained in:
shahaibo
2024-12-19 11:13:30 +08:00
parent 1a19604163
commit 3dc432131c
2 changed files with 11 additions and 8 deletions

View File

@@ -11,9 +11,9 @@ import javax.validation.constraints.NotNull;
@ApiModel("绑定邮箱")
public class AccountBindEmailDTO {
@NotNull(message = "userId.cannot.be.empty")
@ApiModelProperty("用户id")
private Long userId;
// @NotNull(message = "userId.cannot.be.empty")
// @ApiModelProperty("用户id")
// private Long userId;
@NotBlank(message = "email.cannot.be.empty")
@ApiModelProperty("邮箱")

View File

@@ -281,13 +281,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
@Override
public Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO) {
Account account = baseMapper.selectById(accountBindEmailDTO.getUserId());
// Account account = baseMapper.selectById(accountBindEmailDTO.getUserId());
AuthPrincipalVo userHolder = UserContext.getUserHolder();
Account account = accountMapper.selectById(userHolder.getId());
if (Objects.isNull(account)) {
throw new BusinessException("userName.does.not.exist", ResultEnum.PROMPT.getCode());
}
if (StringUtils.isNotBlank(account.getUserEmail())) {
throw new BusinessException("user.has.bound.mailbox");
}
// if (StringUtils.isNotBlank(account.getUserEmail())) {
// throw new BusinessException("user.has.bound.mailbox");
// }
//校验邮箱验证码
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.BIND_MAILBOX.name() + "_" + accountBindEmailDTO.getUserEmail());
if (StringUtils.isBlank(verifyCode)) {
@@ -297,7 +299,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
}
//绑定
updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
account.setUserEmail(accountBindEmailDTO.getUserEmail());
// updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
return Boolean.TRUE;
}