浏览代码

update content/vod

reghao 9 月之前
父节点
当前提交
fc36aa26f1

+ 3 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/ArticleController.java

@@ -2,6 +2,7 @@ package cn.reghao.tnb.content.app.data.controller;
 
 import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.jutil.web.WebResult;
+import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.app.data.model.dto.ArticlePublishSbt;
 import cn.reghao.tnb.content.app.data.model.po.ArticlePost;
 import cn.reghao.tnb.content.app.data.model.vo.AnswerCard;
@@ -30,7 +31,8 @@ public class ArticleController {
     @ApiOperation("获取文章列表")
     @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getArticles(@RequestParam("page") int page) {
-        PageList<ArticleHeader> pageList = articleService.getArticleHeaders(10001, page);
+        long userId = UserContext.getUser();
+        PageList<ArticleHeader> pageList = articleService.getArticleHeaders(userId, page);
         return WebResult.success(pageList);
     }
 

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/AudioService.java

@@ -25,7 +25,7 @@ public class AudioService {
     }
 
     public PageList<UserAudioCard> getAudios(int page) {
-        long userId = 10001;
+        long userId = UserContext.getUser();
         int total = audioPostMapper.countByUserId(userId);
         Page page1 = new Page(page, pageSize);
         List<UserAudioCard> list = audioPostMapper.findAudioCardByUserIdAndByPage(page1, userId);

+ 1 - 21
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoFile.java

@@ -18,7 +18,7 @@ import lombok.Setter;
 public class VideoFile extends BaseObject<Integer> {
     private String videoId;
     // 原始文件的 objectId
-    private String videoFileId;
+    //private String videoFileId;
     private String objectId;
     private Integer channelCode;
     private String videoCodec;
@@ -37,26 +37,6 @@ public class VideoFile extends BaseObject<Integer> {
 
     public VideoFile(String videoId, VideoInfo videoInfo, int channelCode) {
         this.videoId = videoId;
-        this.videoFileId = videoInfo.getVideoFileId();
-        this.objectId = videoInfo.getObjectId();
-        this.channelCode = channelCode;
-        this.videoCodec = videoInfo.getVideoCodec();
-        this.vbitRate = videoInfo.getVbitRate();
-        this.audioCodec = videoInfo.getAudioCodec();
-        this.abitRate = videoInfo.getAbitRate();
-        this.formatName = videoInfo.getFormatName();
-        this.urlType = videoInfo.getUrlType();
-        this.url = videoInfo.getUrl();
-        this.quality = videoInfo.getQuality();
-        this.width = videoInfo.getWidth();
-        this.height = videoInfo.getHeight();
-        this.horizontal = videoInfo.getWidth()>videoInfo.getHeight();
-        this.duration = videoInfo.getDuration();
-    }
-
-    public VideoFile(String videoId, String videoFileId, int channelCode, VideoInfo videoInfo) {
-        this.videoId = videoId;
-        this.videoFileId = videoFileId;
         this.objectId = videoInfo.getObjectId();
         this.channelCode = channelCode;
         this.videoCodec = videoInfo.getVideoCodec();

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/rpc/AdminVideoServiceImpl.java

@@ -168,7 +168,7 @@ public class AdminVideoServiceImpl implements AdminVideoService {
 
     @Override
     public void addConvertedVideo(VideoConvertedDto videoConvertedDto) {
-        String uploadId = videoConvertedDto.getUploadId();
+        /*String uploadId = videoConvertedDto.getUploadId();
         int channelCode = videoConvertedDto.getChannelCode();
         try {
             VideoInfo videoInfo = ossService.getVideoInfo(channelCode, uploadId);
@@ -190,6 +190,6 @@ public class AdminVideoServiceImpl implements AdminVideoService {
             videoRepository.updateVideoPublish(videoId, videoFile);
         } catch (Exception e) {
             e.printStackTrace();
-        }
+        }*/
     }
 }

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPlayServiceImpl.java

@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
  */
 @Service
 public class VideoPlayServiceImpl implements VideoPlayService {
-    @DubboReference(check = false)
+    @DubboReference(check = false, timeout = 60_000, retries = 0)
     private OssService ossService;
     @DubboReference(check = false)
     private UserService userService;

+ 7 - 6
content/content-service/src/main/resources/mapper/vod/VideoFileMapper.xml

@@ -20,26 +20,27 @@
     <delete id="deleteByVideoFileId">
         update vod_video_file
         set deleted=1
-        where video_file_id=#{videoFileId}
+        where object_id=#{videoFileId}
     </delete>
 
     <select id="findAll" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoFile">
-        select * from vod_video_file
+        select *
+        from vod_video_file
     </select>
     <select id="findVideoInfo" resultType="cn.reghao.oss.sdk.model.dto.media.VideoInfo">
         select video_file_id,duration,horizontal,quality,video_codec,audio_codec,url_type,url
         from vod_video_file
-        where video_file_id=#{videoFileId}
+        where `deleted`=0 and object_id=#{videoFileId}
     </select>
     <select id="findByVideoFileId" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoFile">
         select *
         from vod_video_file
-        where video_file_id=#{videoFileId}
+        where `deleted`=0 and object_id=#{videoFileId}
     </select>
     <select id="findVideoUrls" resultType="cn.reghao.oss.sdk.model.dto.media.VideoUrlDto">
-        select video_file_id as object_id,channel_code,url_type as type,url,width,height,quality
+        select object_id,channel_code,url_type as type,url,width,height,quality
         from vod_video_file
-        where video_id=#{videoId}
+        where `deleted`=0 and video_id=#{videoId}
         order by id desc
     </select>
 </mapper>

+ 0 - 3
content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java

@@ -1,11 +1,9 @@
 package cn.reghao.tnb.content.app.vod.service;
 
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
 import cn.reghao.tnb.content.api.dto.VideoCard;
 import cn.reghao.tnb.content.app.ContentApplication;
 import cn.reghao.tnb.content.app.vod.db.mapper.*;
 import cn.reghao.tnb.content.app.vod.model.po.*;
-import cn.reghao.tnb.common.db.GroupCount;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisHash;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisSet;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisSortedSet;
@@ -17,7 +15,6 @@ import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
 
 import java.time.LocalDateTime;
 import java.util.*;