p-honggang.li
5 天以前 cda9decfde8c6b518639c5da506aa293c07f88ff
src/main/java/com/webmanage/controller/PointsController.java
@@ -250,7 +250,7 @@
    @GetMapping("/total/user/{userId}")
    @ApiOperation("获取用户积分统计")
    public Result<UserPoints> getUserPointsTotal(@ApiParam("用户ID") @PathVariable Long userId) {
    public Result<UserPoints> getUserPointsTotal(@ApiParam("用户ID") @PathVariable String userId) {
        try {
            UserPoints userPoints = pointsFlowService.getUserPointsTotal(userId);
            return Result.success(userPoints);
@@ -272,6 +272,24 @@
        }
    }
    // ==================== 积分扣减 ====================
    @PostMapping("/user/deduct")
    @ApiOperation("扣减用户积分")
    public Result<Object> deductUserPoints(@Valid @RequestBody DeductUserPointsDTO deductDTO) {
        try {
            boolean result = pointsFlowService.deductUserPoints(deductDTO);
            if (result) {
                return Result.success("积分扣减成功");
            } else {
                return Result.error("积分扣减失败");
            }
        } catch (Exception e) {
            log.error("积分扣减失败", e);
            return Result.error("积分扣减失败:" + e.getMessage());
        }
    }
    // ==================== 积分流水数据类目 ====================
    @GetMapping("/flow/categories")