无关风月
2025-01-16 ec7528bb6cc65d3bce1c33d59e48ea5bc81c7782
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -574,9 +574,17 @@
    @GetMapping("/danger/down")
    @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"})
    public R down(Long id) {
        AppUser byId = appUserService.getById(id);
        byId.setVipId(byId.getVipId() - 1);
        appUserService.updateById(byId);
        AppUser appUser = appUserService.getById(id);
        UserChangeLog userChangeLog = new UserChangeLog();
        userChangeLog.setDelFlag(0);
        userChangeLog.setCreateTime(LocalDateTime.now());
        userChangeLog.setAppUserId(id);
        userChangeLog.setBeforeVipId(appUser.getVipId());
        userChangeLog.setAfterVipId(appUser.getVipId() - 1);
        userChangeLog.setChangeType(0);
        userChangeLogService.save(userChangeLog);
        appUser.setVipId(appUser.getVipId() - 1);
        appUserService.updateById(appUser);
        return R.ok();
    }