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

Merge pull request !619 from QianRj/dev
This commit is contained in:
疯狂的狮子Li 2024-12-17 05:22:15 +00:00 committed by Gitee
commit 591f86e4e9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

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);