瀏覽代碼

update VideoController

reghao 9 月之前
父節點
當前提交
a40a106a74

+ 5 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/VideoController.java

@@ -4,7 +4,6 @@ import cn.reghao.jutil.jdk.result.Result;
 import cn.reghao.jutil.web.WebResult;
 import cn.reghao.tnb.common.auth.AuthUser;
 import cn.reghao.tnb.content.app.vod.model.dto.VideoErrorReport;
-import cn.reghao.tnb.content.app.vod.model.dto.VideoInfoUpdate;
 import cn.reghao.tnb.content.app.vod.model.vo.DownloadUrl;
 import cn.reghao.tnb.content.app.vod.service.VideoService;
 import io.swagger.annotations.Api;
@@ -27,14 +26,15 @@ public class VideoController {
     }
 
     @ApiOperation(value = "点赞视频", notes = "N")
-    @PostMapping("/thumb")
-    public String thumbUpVideo(@RequestBody @Validated VideoInfoUpdate videoUpdateDto) {
+    @PostMapping("/thumb/{videoId}")
+    public String thumbUpVideo(@PathVariable("videoId") String videoId) {
+        videoService.thumbVideo(videoId);
         return WebResult.success();
     }
 
     @ApiOperation(value = "分享视频", notes = "N")
-    @PostMapping("/share")
-    public String shareVideo(@RequestParam("videoId") String videoId) {
+    @PostMapping("/share/{videoId}")
+    public String shareVideo(@PathVariable("videoId") String videoId) {
         String shortUrl = videoService.getShareLink(videoId);
         return WebResult.success(shortUrl);
     }

+ 9 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoService.java

@@ -33,14 +33,21 @@ public class VideoService {
     private final VideoFileMapper videoFileMapper;
     private final VideoErrorMapper videoErrorMapper;
     private final Set<Long> adminUsers;
+    private VideoStatisticMapper videoStatisticMapper;
 
-    public VideoService(VideoPostMapper videoPostMapper, VideoFileMapper videoFileMapper, VideoErrorMapper videoErrorMapper) {
+    public VideoService(VideoPostMapper videoPostMapper, VideoFileMapper videoFileMapper,
+                        VideoErrorMapper videoErrorMapper, VideoStatisticMapper videoStatisticMapper) {
         this.videoPostMapper = videoPostMapper;
         this.videoFileMapper = videoFileMapper;
         this.videoErrorMapper = videoErrorMapper;
+        this.videoStatisticMapper = videoStatisticMapper;
         this.adminUsers = Set.of(10001L, 10002L);
     }
 
+    public void thumbVideo(String videoId) {
+        //videoStatisticMapper.updateIncrView(videoId);
+    }
+
     public Result errorReport(VideoErrorReport videoErrorReport) {
         long loginUser = UserContext.getUser();
         if (!adminUsers.contains(loginUser)) {
@@ -80,7 +87,7 @@ public class VideoService {
     }
 
     public String getShareLink(String videoId) {
-        return null;
+        return "";
     }
 
     public DownloadUrl downloadVideo(String videoId) {