|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.luoo.music.controller;
|
|
|
|
|
|
|
|
|
|
import com.luoo.music.dto.mapper.SongMapper;
|
|
|
|
|
import com.luoo.music.dto.request.CollectQueryReq;
|
|
|
|
|
import com.luoo.music.dto.response.SongRespDTO;
|
|
|
|
|
import com.luoo.music.pojo.JournalSong;
|
|
|
|
|
import com.luoo.music.service.JournalService;
|
|
|
|
@ -21,7 +22,6 @@ import util.JwtUtil;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
@ -77,20 +77,16 @@ public class SongController {
|
|
|
|
|
return journalService.isLatest10ByJournalNo(journalNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "2.查询收藏歌曲信息")
|
|
|
|
|
@ApiOperation(value = "2.查询收藏歌曲信息", notes = "pageNum/pageSize不传或者小于1,则返回所有收藏歌曲")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户id", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "pageNum", value = "分页: 页码,以1开始", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "分页: 每页数量", required = true) })
|
|
|
|
|
@GetMapping("/collect/{userId}/{pageNum}/{pageSize}")
|
|
|
|
|
@ApiImplicitParam(name = "pageNum", value = "分页: 页码", required = false),
|
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "分页: 每页数量", required = false) })
|
|
|
|
|
@GetMapping("/collect")
|
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
|
public Result<PageResult<SongRespDTO>> collectPage(
|
|
|
|
|
public Result<PageResult<SongRespDTO>> collectSongs(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) String userId,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) Integer pageNum,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) Integer pageSize) {
|
|
|
|
|
|
|
|
|
|
Pageable pageable = PageRequest.of(pageNum-1,pageSize);
|
|
|
|
|
List<String> objectIds=userCollectInfoService.findByUserIdAndCollectType(userId, CollectTypeEnum.SONG, pageable);
|
|
|
|
|
@VerifyParam CollectQueryReq queryReq) {
|
|
|
|
|
List<String> objectIds= getSongIds(queryReq);
|
|
|
|
|
if (objectIds.isEmpty()) {
|
|
|
|
|
return Result.success(new PageResult<SongRespDTO>(0L, Collections.emptyList()));
|
|
|
|
|
}
|
|
|
|
@ -101,6 +97,14 @@ public class SongController {
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
return Result.success(new PageResult<SongRespDTO>(Long.valueOf(results.size()), results));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> getSongIds(CollectQueryReq queryReq) {
|
|
|
|
|
if(null==queryReq.getPageNum()||queryReq.getPageNum()<1||null==queryReq.getPageSize()||queryReq.getPageSize()<1) {
|
|
|
|
|
return userCollectInfoService.findByUserIdAndCollectType(queryReq.getUserId(), CollectTypeEnum.SONG);
|
|
|
|
|
}
|
|
|
|
|
PageRequest pageRequest = PageRequest.of(queryReq.getPageNum()-1, queryReq.getPageSize());
|
|
|
|
|
return userCollectInfoService.findByUserIdAndCollectType(queryReq.getUserId(), CollectTypeEnum.SONG, pageRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.随机播放歌曲", notes = "雀乐FM")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "limit", value = "随机歌曲数,最少1首,最多30首", required = false) })
|
|
|
|
|