| | |
| | | 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; |
| | |
| | | private final RocketMQTemplate rocketMQTemplate; |
| | | private final ThumbsUpRecordService thumbsUpRecordService; |
| | | private final ElasticsearchOperations restTemplate; |
| | | private final TencentCdnUtil cdnUtil; |
| | | |
| | | @Qualifier("videoEsServiceImpl") |
| | | private final EsService esService; |
| | |
| | | video.setAuditPassTime(new Date()); |
| | | |
| | | fields.put("status", VideoStatusEnum.PUBLISHED.getValue()); |
| | | |
| | | // 调cdn预热 |
| | | cdnUtil.pushUrlsCache(new String[]{video.getCoverUrl(), video.getVideoFileKey()}); |
| | | } else { |
| | | video.setStatus(VideoStatusEnum.REJECT.getValue()); |
| | | fields.put("status", VideoStatusEnum.REJECT.getValue()); |
| | |
| | | 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(); |
| | | } |
| | | |
| | |
| | | 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())) { |
| | | v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey())); |
| | | |
| | | String coverFileKey = v.getCoverFileKey(); |
| | | v.setCoverUrl(cosUtil.getPreviewUrl(coverFileKey)); |
| | | if (StringUtils.isNotBlank(coverFileKey) && !coverFileKey.contains("http")) { |
| | | v.setCoverUrl(cosUtil.getPreviewUrl(coverFileKey)); |
| | | } |
| | | |
| | | } 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())); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param page |
| | | * @param videoId videoId推荐的视频id |
| | | */ |
| | |
| | | } else { |
| | | vo.setLikeNum(0L); |
| | | } |
| | | if (StringUtils.isNotBlank(vo.getAvatar())&&!vo.getAvatar().contains("http")) { |
| | | vo.setAvatar(cosUtil.getPreviewUrl(vo.getAvatar())); |
| | | } |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | |
| | | 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())); |
| | |
| | | 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())); |
| | | String authorAvatar = v.getAuthorAvatar(); |
| | | if (StringUtils.isNotBlank(authorAvatar)&&!authorAvatar.contains("http")) { |
| | | v.setAuthorAvatar(cosUtil.getPreviewUrl(authorAvatar)); |
| | | } |
| | | if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) { |
| | | v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey())); |
| | | v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey())); |
| | |
| | | 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())); |
| | | if (StringUtils.isNotBlank(v.getCoverFileKey())) { |
| | | 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())); |
| | | } |