feat(themes): 新增推荐主题与用户主题批量删除功能
- 新增 getRecommendedThemes:按真实下载量降序返回8个未购买主题 - 新增 batchDeleteUserThemes:支持用户批量逻辑删除已购主题 - 补充接口注释与 Swagger 文档,开放 /themes/recommended 免鉴权路径
This commit is contained in:
@@ -83,4 +83,12 @@ public class ThemesController {
|
||||
return ResultUtils.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/recommended")
|
||||
@Operation(summary = "推荐主题列表", description = "按真实下载数量降序返回推荐主题")
|
||||
public BaseResponse<List<KeyboardThemesRespVO>> getRecommendedThemes() {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
List<KeyboardThemesRespVO> result = themesService.getRecommendedThemes(userId);
|
||||
return ResultUtils.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yolo.keyborad.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.yolo.keyborad.common.BaseResponse;
|
||||
import com.yolo.keyborad.common.ResultUtils;
|
||||
import com.yolo.keyborad.model.dto.usertheme.BatchDeleteUserThemesReq;
|
||||
import com.yolo.keyborad.service.KeyboardUserThemesService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/11
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/user-themes")
|
||||
@Tag(name = "用户主题")
|
||||
public class UserThemesController {
|
||||
|
||||
@Resource
|
||||
private KeyboardUserThemesService userThemesService;
|
||||
|
||||
@PostMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除用户主题", description = "批量逻辑删除用户主题")
|
||||
public BaseResponse<Boolean> batchDeleteUserThemes(@RequestBody BatchDeleteUserThemesReq req) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
userThemesService.batchDeleteUserThemes(userId, req.getThemeIds());
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user