blob: d99c4d03b0ce019203891e4d9268e009a042d0c7 [file] [log] [blame]
package com.example.myproject.controller;
import com.example.myproject.entity.TorrentEntity;
import com.example.myproject.service.PopularSeedService;
import com.example.myproject.service.RecommendationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/echo/recommendation")
@Api("推荐接口")
public class RecommendationController {
@Autowired
private RecommendationService recommendationService;
@Autowired
private PopularSeedService popularSeedService;
@GetMapping("/seeds/{userId}")
@ApiOperation("获取基于内容的种子推荐")
public List<TorrentEntity> getRecommendedSeeds(@PathVariable Long userId) {
return recommendationService.getRecommendedSeeds(userId);
}
@GetMapping("/popular")
@ApiOperation("获取热门种子推荐")
public List<TorrentEntity> getPopularSeeds(
@ApiParam(value = "返回数量", defaultValue = "16")
@RequestParam(defaultValue = "16") int limit
) {
return popularSeedService.getPopularSeeds(limit);
}
}