feat(playlist): 增加歌单收藏状态检查功能
- 新增 isPlaylistCollected 接口和相关实现 - 修改 toggleCollectPlaylist 函数,增加当前收藏状态参数 - 在前端 PlaylistDetail 组件中添加收藏状态检查逻辑 - 后端增加对应的控制层、服务层和实现类方法
This commit is contained in:
@@ -189,6 +189,19 @@ public class PlaylistController {
|
||||
return Result.success("取消收藏成功", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前用户是否收藏了该歌单
|
||||
*
|
||||
* @param id 歌单ID
|
||||
* @return 响应结果
|
||||
*/
|
||||
@SaCheckLogin
|
||||
@GetMapping("/{id}/is-collected")
|
||||
public Result<Boolean> isCollected(@PathVariable Long id) {
|
||||
boolean result = playlistService.isCollected(id);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏的歌单列表
|
||||
*
|
||||
|
||||
@@ -175,6 +175,19 @@ public class SingerController {
|
||||
return Result.success("取消收藏成功", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前用户是否收藏了该歌手
|
||||
*
|
||||
* @param id 歌手ID
|
||||
* @return 响应结果
|
||||
*/
|
||||
@SaCheckLogin
|
||||
@GetMapping("/{id}/is-collected")
|
||||
public Result<Boolean> isCollected(@PathVariable Long id) {
|
||||
boolean result = singerService.isCollected(id);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏的歌手列表
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user