mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 10:57:10 +08:00 
			
		
		
		
	chore: 优化个人中心部分参数命名
This commit is contained in:
		@@ -102,7 +102,7 @@ public class UserInfoResp implements Serializable {
 | 
			
		||||
     * 密码是否已过期
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "密码是否已过期", example = "true")
 | 
			
		||||
    private Boolean passwordExpired;
 | 
			
		||||
    private Boolean pwdExpired;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建时间
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ public class UserEmailUpdateRequest implements Serializable {
 | 
			
		||||
    @Schema(description = "新邮箱", example = "123456789@qq.com")
 | 
			
		||||
    @NotBlank(message = "新邮箱不能为空")
 | 
			
		||||
    @Pattern(regexp = RegexPool.EMAIL, message = "邮箱格式错误")
 | 
			
		||||
    private String newEmail;
 | 
			
		||||
    private String email;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 验证码
 | 
			
		||||
@@ -60,5 +60,5 @@ public class UserEmailUpdateRequest implements Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "当前密码(加密)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
 | 
			
		||||
    @NotBlank(message = "当前密码不能为空")
 | 
			
		||||
    private String currentPassword;
 | 
			
		||||
    private String oldPassword;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ public class UserPhoneUpdateReq implements Serializable {
 | 
			
		||||
    @Schema(description = "新手机号", example = "13811111111")
 | 
			
		||||
    @NotBlank(message = "新手机号不能为空")
 | 
			
		||||
    @Pattern(regexp = RegexPool.MOBILE, message = "手机号格式错误")
 | 
			
		||||
    private String newPhone;
 | 
			
		||||
    private String phone;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 验证码
 | 
			
		||||
@@ -60,5 +60,5 @@ public class UserPhoneUpdateReq implements Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "当前密码(加密)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
 | 
			
		||||
    @NotBlank(message = "当前密码不能为空")
 | 
			
		||||
    private String currentPassword;
 | 
			
		||||
    private String oldPassword;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -76,20 +76,20 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改手机号
 | 
			
		||||
     *
 | 
			
		||||
     * @param newPhone        新手机号
 | 
			
		||||
     * @param currentPassword 当前密码
 | 
			
		||||
     * @param id              ID
 | 
			
		||||
     * @param newPhone    新手机号
 | 
			
		||||
     * @param oldPassword 当前密码
 | 
			
		||||
     * @param id          ID
 | 
			
		||||
     */
 | 
			
		||||
    void updatePhone(String newPhone, String currentPassword, Long id);
 | 
			
		||||
    void updatePhone(String newPhone, String oldPassword, Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改邮箱
 | 
			
		||||
     *
 | 
			
		||||
     * @param newEmail        新邮箱
 | 
			
		||||
     * @param currentPassword 当前密码
 | 
			
		||||
     * @param id              ID
 | 
			
		||||
     * @param newEmail    新邮箱
 | 
			
		||||
     * @param oldPassword 当前密码
 | 
			
		||||
     * @param id          ID
 | 
			
		||||
     */
 | 
			
		||||
    void updateEmail(String newEmail, String currentPassword, Long id);
 | 
			
		||||
    void updateEmail(String newEmail, String oldPassword, Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 重置密码
 | 
			
		||||
 
 | 
			
		||||
@@ -262,9 +262,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updatePhone(String newPhone, String currentPassword, Long id) {
 | 
			
		||||
    public void updatePhone(String newPhone, String oldPassword, Long id) {
 | 
			
		||||
        UserDO user = super.getById(id);
 | 
			
		||||
        CheckUtils.throwIf(!passwordEncoder.matches(currentPassword, user.getPassword()), "当前密码错误");
 | 
			
		||||
        CheckUtils.throwIf(!passwordEncoder.matches(oldPassword, user.getPassword()), "当前密码错误");
 | 
			
		||||
        CheckUtils.throwIf(this.isPhoneExists(newPhone, id), "手机号已绑定其他账号,请更换其他手机号");
 | 
			
		||||
        CheckUtils.throwIfEqual(newPhone, user.getPhone(), "新手机号不能与当前手机号相同");
 | 
			
		||||
        // 更新手机号
 | 
			
		||||
@@ -272,9 +272,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateEmail(String newEmail, String currentPassword, Long id) {
 | 
			
		||||
    public void updateEmail(String newEmail, String oldPassword, Long id) {
 | 
			
		||||
        UserDO user = super.getById(id);
 | 
			
		||||
        CheckUtils.throwIf(!passwordEncoder.matches(currentPassword, user.getPassword()), "当前密码错误");
 | 
			
		||||
        CheckUtils.throwIf(!passwordEncoder.matches(oldPassword, user.getPassword()), "当前密码错误");
 | 
			
		||||
        CheckUtils.throwIf(this.isEmailExists(newEmail, id), "邮箱已绑定其他账号,请更换其他邮箱");
 | 
			
		||||
        CheckUtils.throwIfEqual(newEmail, user.getEmail(), "新邮箱不能与当前邮箱相同");
 | 
			
		||||
        // 更新邮箱
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user