xiangpei
5 天以前 0bcc66233bfe26a356c7ffa820f6a97a214a9b49
视频接口完善
1个文件已修改
23 ■■■■■ 已修改文件
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -318,11 +318,11 @@
                v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId())));
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
//                    v.setVideoUrl("https://videos.pexels.com/video-files/13602965/13602965-hd_1920_1080_30fps.mp4");
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                } else if (VideoContentTypeEnum.IMG.getValue().equals(v.getVideoContentType()) && StringUtils.isNotBlank(v.getVideoImgs())) {
                    v.setImgs(JSON.parseArray(v.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
                }
                v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                v.setSubscribeThisAuthor(subscribes.contains(v.getAuthorId()));
            });
        }
@@ -338,11 +338,10 @@
            page.getRecords().forEach(v -> {
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
//                    v.setVideoUrl("https://videos.pexels.com/video-files/13602965/13602965-hd_1920_1080_30fps.mp4");
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                } else if (VideoContentTypeEnum.IMG.getValue().equals(v.getVideoContentType()) && StringUtils.isNotBlank(v.getVideoImgs())) {
                    v.setImgs(JSON.parseArray(v.getVideoImgs(), String.class).stream().map(cosUtil::getPreviewUrl).collect(Collectors.toList()));
                }
                v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
            });
        }
        return Result.ok().data(page.getRecords());
@@ -400,9 +399,14 @@
        query.setAuthorSelf(UserContext.getCurrentUserId().equals(query.getAuthorId()));
        baseMapper.getAuthorVideoPage(page, query);
        for (WxVideoVO vo : page.getRecords()) {
            if (VideoContentTypeEnum.VIDEO.getValue().equals(vo.getVideoContentType())) {
                vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
            vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverFileKey()));
//            vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
            vo.setVideoUrl("https://videos.pexels.com/video-files/13602965/13602965-hd_1920_1080_30fps.mp4");
            } else if (VideoContentTypeEnum.IMG.getValue().equals(vo.getVideoContentType()) && StringUtils.isNotBlank(vo.getVideoImgs())) {
                vo.setImgs(JSON.parseArray(vo.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
            }
            vo.setOptions(VideoSupportOpEnum.getVideoOpByStatus(vo.getStatus()));
        }
        return Result.ok().data(page.getRecords()).total(page.getTotal());
@@ -413,9 +417,12 @@
        IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
        baseMapper.getAuthorCollectVideoPage(page, query);
        for (WxVideoVO vo : page.getRecords()) {
            if (VideoContentTypeEnum.VIDEO.getValue().equals(vo.getVideoContentType())) {
                vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
            vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverFileKey()));
//            vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
            vo.setVideoUrl("https://videos.pexels.com/video-files/13602965/13602965-hd_1920_1080_30fps.mp4");
            } else if (VideoContentTypeEnum.IMG.getValue().equals(vo.getVideoContentType()) && StringUtils.isNotBlank(vo.getVideoImgs())) {
                vo.setImgs(JSON.parseArray(vo.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
            }
            vo.setCollected(Boolean.TRUE);
        }
        return Result.ok().data(page.getRecords()).total(page.getTotal());