From 71f0e421e4e30a98fa61e3f9f5b62d4eaf84bae8 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期日, 29 六月 2025 19:58:01 +0800 Subject: [PATCH] 视频商品封面加载 --- framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 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 57909e0..5f7b7ad 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 @@ -140,6 +140,11 @@ } 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())); } + if (CollectionUtils.isNotEmpty(vo.getGoodsList())) { + vo.getGoodsList().stream().forEach(goods -> { + goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail())); + }); + } return Result.ok().data(vo); } @@ -401,7 +406,11 @@ } 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())); } - + if (CollectionUtils.isNotEmpty(v.getGoodsList())) { + v.getGoodsList().stream().forEach(goods -> { + goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail())); + }); + } v.setSubscribeThisAuthor(subscribes.contains(v.getAuthorId())); }); } @@ -571,6 +580,9 @@ @Override public Result getGoodsDetail(String videoId) { List<VideoGoodsDetailVO> goodsList = baseMapper.getVideoGoods(videoId); + goodsList.stream().forEach(goods -> { + goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail())); + }); return Result.ok().data(goodsList); } -- Gitblit v1.8.0