|
|
@ -6,9 +6,13 @@ import com.luoo.music.pojo.Song;
|
|
|
|
import com.luoo.music.service.SongService;
|
|
|
|
import com.luoo.music.service.SongService;
|
|
|
|
|
|
|
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
import constants.Constants;
|
|
|
|
import constants.Constants;
|
|
|
|
|
|
|
|
import enums.VerifyRegexEnum;
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@ -49,17 +53,18 @@ public class SongController {
|
|
|
|
return Result.success(results);
|
|
|
|
return Result.success(results);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ApiOperation(value = "2.随机播放歌曲", notes = "雀乐FM")
|
|
|
|
* @ApiOperation(value = "2.随机播放歌曲",notes="雀乐FM")
|
|
|
|
@ApiImplicitParams({
|
|
|
|
*
|
|
|
|
@ApiImplicitParam(name = "limit", value = "随机歌曲数,最少1首,最多30首", required = false)
|
|
|
|
* @GetMapping("/random/{limit}")
|
|
|
|
})
|
|
|
|
*
|
|
|
|
@GetMapping("/random/{limit}")
|
|
|
|
* @GlobalInterceptor(checkLogin = true) public Result<List<SongRespDTO>>
|
|
|
|
@GlobalInterceptor(checkLogin = true)
|
|
|
|
* getByJournalNo(@RequestHeader(value = "token", required = false) String
|
|
|
|
public Result<List<SongRespDTO>> random(@RequestHeader(value = "token", required = false) String token,
|
|
|
|
* token) { List<Song> songs = songService.random(); List<SongRespDTO> results =
|
|
|
|
@PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.RANDOM_SONG_LIMIT) Integer limit) {
|
|
|
|
* songs.stream().map(s -> getSongRespDTO(s)).collect(Collectors.toList());
|
|
|
|
List<Song> songs = songService.random(limit);
|
|
|
|
* return Result.success(results); }
|
|
|
|
List<SongRespDTO> results = songs.stream().map(s -> getSongRespDTO(s)).collect(Collectors.toList());
|
|
|
|
*/
|
|
|
|
return Result.success(results);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SongRespDTO getSongRespDTO(Song song) {
|
|
|
|
private SongRespDTO getSongRespDTO(Song song) {
|
|
|
|
SongRespDTO songRespDTO = new SongRespDTO();
|
|
|
|
SongRespDTO songRespDTO = new SongRespDTO();
|
|
|
|