From 2a7b0a64b14b22ec45f8a0f6e4764bc3cd16919c Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期一, 27 十月 2025 17:08:24 +0800
Subject: [PATCH] 调整
---
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 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 9b1ef82..c94ce90 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
@@ -26,6 +26,7 @@
import cn.lili.rocketmq.tags.CommentTagsEnum;
import cn.lili.rocketmq.tags.VideoTagsEnum;
import cn.lili.utils.COSUtil;
+import cn.lili.utils.TencentCdnUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.lili.modules.lmk.mapper.VideoMapper;
@@ -92,6 +93,7 @@
private final RocketMQTemplate rocketMQTemplate;
private final ThumbsUpRecordService thumbsUpRecordService;
private final ElasticsearchOperations restTemplate;
+ private final TencentCdnUtil cdnUtil;
@Qualifier("videoEsServiceImpl")
private final EsService esService;
@@ -588,6 +590,9 @@
video.setAuditPassTime(new Date());
fields.put("status", VideoStatusEnum.PUBLISHED.getValue());
+
+ // 璋僣dn棰勭儹
+ cdnUtil.pushUrlsCache(new String[]{video.getCoverUrl(), video.getVideoFileKey()});
} else {
video.setStatus(VideoStatusEnum.REJECT.getValue());
fields.put("status", VideoStatusEnum.REJECT.getValue());
@@ -600,6 +605,7 @@
dto.setFields(fields);
String destination = rocketmqCustomProperties.getVideoTopic() + ":" + VideoTagsEnum.ES_DOC_UPDATE_SOME_FIELD.name();
rocketMQTemplate.asyncSend(destination, JSON.toJSONString(dto), RocketmqSendCallbackBuilder.commonCallback());
+
return Result.ok();
}
@@ -738,7 +744,7 @@
v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
String authorAvatar = v.getAuthorAvatar();
- if (StringUtils.isNotBlank(authorAvatar)&&!authorAvatar.contains("http")) {
+ if (StringUtils.isNotBlank(authorAvatar) && !authorAvatar.contains("http")) {
v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
}
if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
@@ -860,7 +866,6 @@
}
/**
- *
* @param page
* @param videoId videoId鎺ㄨ崘鐨勮棰慽d
*/
@@ -984,6 +989,9 @@
} else {
vo.setLikeNum(0L);
}
+ if (StringUtils.isNotBlank(vo.getAvatar())&&!vo.getAvatar().contains("http")) {
+ vo.setAvatar(cosUtil.getPreviewUrl(vo.getAvatar()));
+ }
return Result.ok().data(vo);
}
@@ -1011,7 +1019,9 @@
v.setCommentNum(this.getCommentNum(v.getId(), v.getCommentNum()));
v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
- v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
+ if (StringUtils.isNotBlank(v.getAuthorAvatar())&&!v.getAuthorAvatar().contains("http")) {
+ v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
+ }
if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
@@ -1541,7 +1551,7 @@
v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
- if(StringUtils.isNotBlank(v.getCoverFileKey())){
+ if (StringUtils.isNotBlank(v.getCoverFileKey())) {
v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
}
--
Gitblit v1.8.0