From baa730b5518b5f73c14d0af5868641299b3fe2e4 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 12 六月 2025 19:56:36 +0800 Subject: [PATCH] 视频图片处理 --- framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java index 0468ed1..74b939e 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java @@ -130,7 +130,11 @@ Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); List<SimpleVideoTagVO> tags = videoTagRefService.getTagsByVideoIds(Arrays.asList(id)); vo.setTagList(tags); - vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey())); + if (VideoContentTypeEnum.VIDEO.getValue().equals(vo.getVideoContentType())) { + vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey())); + } 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())); + } return Result.ok().data(vo); } @@ -299,8 +303,12 @@ v.setGoods(new VideoGoodsVO()); v.setTagList(tagMap.get(v.getId())); v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId()))); -// v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey())); - v.setVideoUrl("https://videos.pexels.com/video-files/13602965/13602965-hd_1920_1080_30fps.mp4"); + 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"); + } 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())); }); -- Gitblit v1.8.0