|
@@ -12,6 +12,7 @@ import cn.reghao.tnb.content.app.vod.model.vo.BannerVideoVO;
|
|
|
import cn.reghao.tnb.content.app.vod.model.vo.VideoDetail;
|
|
import cn.reghao.tnb.content.app.vod.model.vo.VideoDetail;
|
|
|
import cn.reghao.tnb.content.app.vod.service.RecommendService;
|
|
import cn.reghao.tnb.content.app.vod.service.RecommendService;
|
|
|
import cn.reghao.tnb.content.app.vod.service.VideoPostQuery;
|
|
import cn.reghao.tnb.content.app.vod.service.VideoPostQuery;
|
|
|
|
|
+import cn.reghao.tnb.content.app.vod.service.VideoQueryService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -35,10 +36,13 @@ public class VideoQueryController {
|
|
|
private AccountQuery accountQuery;
|
|
private AccountQuery accountQuery;
|
|
|
private final VideoPostQuery videoPostQuery;
|
|
private final VideoPostQuery videoPostQuery;
|
|
|
private final RecommendService recommendService;
|
|
private final RecommendService recommendService;
|
|
|
|
|
+ private final VideoQueryService videoQueryService;
|
|
|
|
|
|
|
|
- public VideoQueryController(VideoPostQuery videoPostQuery, RecommendService recommendService) {
|
|
|
|
|
|
|
+ public VideoQueryController(VideoPostQuery videoPostQuery, RecommendService recommendService,
|
|
|
|
|
+ VideoQueryService videoQueryService) {
|
|
|
this.videoPostQuery = videoPostQuery;
|
|
this.videoPostQuery = videoPostQuery;
|
|
|
this.recommendService = recommendService;
|
|
this.recommendService = recommendService;
|
|
|
|
|
+ this.videoQueryService = videoQueryService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@TimeConsumed
|
|
@TimeConsumed
|
|
@@ -82,19 +86,30 @@ public class VideoQueryController {
|
|
|
@ApiOperation(value = "获取和某个视频类似的视频", notes = "N")
|
|
@ApiOperation(value = "获取和某个视频类似的视频", notes = "N")
|
|
|
@GetMapping(value = "/similar", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
@GetMapping(value = "/similar", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String getSimilarVideos(@RequestParam("videoId") String videoId) {
|
|
public String getSimilarVideos(@RequestParam("videoId") String videoId) {
|
|
|
- String jsonResult = recommendService.getSimilarVideos(videoId);
|
|
|
|
|
|
|
+ String jsonResult = videoQueryService.getSimilarVideos(videoId);
|
|
|
return jsonResult;
|
|
return jsonResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取热门视频", notes = "N")
|
|
@ApiOperation(value = "获取热门视频", notes = "N")
|
|
|
@GetMapping(value = "/hot", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
@GetMapping(value = "/hot", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String getHotList() {
|
|
public String getHotList() {
|
|
|
- List<BannerVideoVO> list = recommendService.getBannerVideos();
|
|
|
|
|
|
|
+ List<BannerVideoVO> list = videoQueryService.getBannerVideos();
|
|
|
return WebResult.success(list);
|
|
return WebResult.success(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @TimeConsumed
|
|
|
|
|
+ @AuthUser
|
|
|
|
|
+ @ApiOperation(value = "获取用户的视频时间线", notes = "N")
|
|
|
|
|
+ @GetMapping(value = "/timeline", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
|
+ public String getVideoTimeline(@RequestParam("nextId") String nextId) {
|
|
|
|
|
+ long userId = UserContext.getUser();
|
|
|
|
|
+ PageScroll<VideoCard> pageScroll = videoQueryService.getVideoTimeline(userId, nextId);
|
|
|
|
|
+ return WebResult.success(pageScroll);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "获取推荐视频", notes = "N")
|
|
@ApiOperation(value = "获取推荐视频", notes = "N")
|
|
|
@GetMapping(value = "/recommend", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
@GetMapping(value = "/recommend", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
|
+ @Deprecated
|
|
|
public String getRecommendVideos(@RequestParam(value = "nextId", required = false) String nextId) {
|
|
public String getRecommendVideos(@RequestParam(value = "nextId", required = false) String nextId) {
|
|
|
if (Integer.parseInt(nextId) > 100) {
|
|
if (Integer.parseInt(nextId) > 100) {
|
|
|
return WebResult.success(Collections.emptyList());
|
|
return WebResult.success(Collections.emptyList());
|
|
@@ -104,14 +119,4 @@ public class VideoQueryController {
|
|
|
List<VideoCard> list = recommendService.getRecommendVideos(userId, nextId);
|
|
List<VideoCard> list = recommendService.getRecommendVideos(userId, nextId);
|
|
|
return WebResult.success(list);
|
|
return WebResult.success(list);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- @TimeConsumed
|
|
|
|
|
- @AuthUser
|
|
|
|
|
- @ApiOperation(value = "获取用户的视频时间线", notes = "N")
|
|
|
|
|
- @GetMapping(value = "/timeline", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
|
- public String getVideoTimeline(@RequestParam("nextId") String nextId) {
|
|
|
|
|
- long userId = UserContext.getUser();
|
|
|
|
|
- PageScroll<VideoCard> pageScroll = recommendService.getVideoTimeline(userId, nextId);
|
|
|
|
|
- return WebResult.success(pageScroll);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|