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

This commit is contained in:
2025-01-10 17:16:08 +08:00
parent 931a4cf807
commit ac2454fd0e
4 changed files with 14 additions and 7 deletions

View File

@@ -326,8 +326,8 @@ public class AccountController {
@GetMapping("/bindEmail")
@ApiOperation(value = "绑定邮箱")
public Response<Boolean> bindEmail(@RequestParam("email") String email, @RequestParam("country") String country, @RequestParam("occupation") String occupation) {
return Response.success(accountService.bindEmail(email, country, occupation));
public Response<Boolean> bindEmail(@RequestParam("email") String email) {
return Response.success(accountService.bindEmail(email));
}
@GetMapping("/unbindWeChat")

View File

@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("绑定邮箱")
@@ -22,4 +21,12 @@ 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

@@ -49,7 +49,7 @@ public interface AccountService extends IService<Account> {
*/
Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO);
Boolean bindEmail(String email, String country, String occupation);
Boolean bindEmail(String email);
/**
* 忘记密码

View File

@@ -305,6 +305,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
//绑定
account.setUserEmail(accountBindEmailDTO.getUserEmail());
account.setCountry(accountBindEmailDTO.getCountry());
account.setOccupation(accountBindEmailDTO.getOccupation());
accountMapper.updateById(account);
// updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
return Boolean.TRUE;
@@ -2586,12 +2588,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
@Override
public Boolean bindEmail(String email, String country, String occupation) {
public Boolean bindEmail(String email) {
AuthPrincipalVo userHolder = UserContext.getUserHolder();
Account account = accountMapper.selectById(userHolder.getId());
account.setUserEmail(email);
account.setCountry(country);
account.setOccupation(occupation);
accountMapper.updateById(account);
return Boolean.TRUE;
}