绑定邮箱时添加国家、职业信息

This commit is contained in:
2025-01-13 10:55:08 +08:00
parent ac2454fd0e
commit ab303cfeef
3 changed files with 15 additions and 8 deletions

View File

@@ -21,12 +21,4 @@ public class AccountBindEmailDTO {
@NotBlank(message = "emailVerifyCode.cannot.be.empty")
@ApiModelProperty("邮箱验证码")
private String emailVerifyCode;
@NotBlank(message = "country cannot be empty" )
@ApiModelProperty("国家")
private String country;
@NotBlank(message = "occupation cannot be empty")
@ApiModelProperty("职业")
private String occupation;
}

View File

@@ -21,4 +21,10 @@ public class EmailSendDTO {
@ApiModelProperty("异常ip")
private String ip;
@ApiModelProperty("国家")
private String country;
@ApiModelProperty("职业")
private String occupation;
}

View File

@@ -418,6 +418,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
result = SendEmailUtil.send(emailSendDTO.getEmail(), null,
SendEmailUtil.BIND_MAILBOX_TEMPLATE_ID, randomVerifyCode);
if (!StringUtil.isNullOrEmpty(emailSendDTO.getCountry()) || !StringUtil.isNullOrEmpty(emailSendDTO.getOccupation())){
Long accountId = UserContext.getUserHolder().getId();
Account account = baseMapper.selectById(accountId);
account.setCountry(emailSendDTO.getCountry());
account.setOccupation(emailSendDTO.getOccupation());
baseMapper.updateById(account);
}
break;
case CHANGE_MAILBOX:
result = SendEmailUtil.send(emailSendDTO.getEmail(), null,