fix: 修复数据权限导致的个人中心的修改头像和修改密码接口错误

This commit is contained in:
QianRj 2024-12-17 12:35:19 +08:00
parent 60af92ed2d
commit 9768023d38

View File

@ -98,8 +98,8 @@ public class SysProfileController extends BaseController {
if (BCrypt.checkpw(bo.getNewPassword(), password)) {
return R.fail("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword())) > 0) {
int rows = DataPermissionHelper.ignore(() -> userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword())));
if (rows > 0) {
return R.ok();
}
return R.fail("修改密码异常,请联系管理员");
@ -121,7 +121,8 @@ public class SysProfileController extends BaseController {
}
SysOssVo oss = ossService.upload(avatarfile);
String avatar = oss.getUrl();
if (userService.updateUserAvatar(LoginHelper.getUserId(), oss.getOssId())) {
boolean updateSuccess = DataPermissionHelper.ignore(() -> userService.updateUserAvatar(LoginHelper.getUserId(), oss.getOssId()));
if (updateSuccess) {
AvatarVo avatarVo = new AvatarVo();
avatarVo.setImgUrl(avatar);
return R.ok(avatarVo);