feat(playlist): 优化歌单详情页面加载逻辑
- 将评论获取移至歌单详情获取成功后 - 添加评论数到歌单 DTO - 优化前端歌单详情展示
This commit is contained in:
@@ -75,6 +75,9 @@ public class PlaylistServiceImpl implements PlaylistService {
|
||||
@Autowired
|
||||
private PlayHistoryRepository playHistoryRepository;
|
||||
|
||||
@Autowired
|
||||
private CommentRepository commentRepository;
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
@@ -590,6 +593,10 @@ public class PlaylistServiceImpl implements PlaylistService {
|
||||
playlistDTO.setSongCount(0);
|
||||
}
|
||||
|
||||
// 设置评论数 (targetType=2 代表歌单)
|
||||
long commentCount = commentRepository.countByTargetIdAndTargetType(playlist.getId(), 2);
|
||||
playlistDTO.setCommentCount((int) commentCount);
|
||||
|
||||
// 检查当前登录用户是否已收藏该歌单
|
||||
if (StpUtil.isLogin()) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
|
||||
Reference in New Issue
Block a user