|
@@ -218,14 +218,14 @@ public class ContentServiceImpl implements ContentService {
|
|
|
public List<VideoDetail> getPublishVideoDetail(PublishContent publishContent, PlanAccount planAccount, MatchVideo matchVideo) {
|
|
|
List<CrawlerVideo> contentMiniVideos = getContentMiniVideo(publishContent, planAccount);
|
|
|
log.info("getPublishVideoDetail contentMiniVideos={}", contentMiniVideos);
|
|
|
- if (contentMiniVideos.size() < 2) {
|
|
|
- publicContentService.delPublishContent(publishContent);
|
|
|
+ if (CollectionUtils.isEmpty(contentMiniVideos)) {
|
|
|
+ LarkRobotUtil.sendMessage("文章获取小程序为空 publishContent.getSourceId=" + publishContent.getSourceId());
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
List<VideoDetail> videoDetails = publishVideo(contentMiniVideos, matchVideo);
|
|
|
log.info("getPublishVideoDetail videoDetails={}", videoDetails);
|
|
|
- if (videoDetails.size() < 2) {
|
|
|
- publicContentService.delPublishContent(publishContent);
|
|
|
+ if (CollectionUtils.isEmpty(videoDetails)) {
|
|
|
+ LarkRobotUtil.sendMessage("发布后小程序为空 publishContent.getSourceId=" + publishContent.getSourceId());
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
return videoDetails;
|
|
@@ -289,27 +289,9 @@ public class ContentServiceImpl implements ContentService {
|
|
|
example.setOrderByClause("score desc");
|
|
|
example.createCriteria().andDownloadStatusEqualTo(2).andContentIdEqualTo(publishContent.getSourceId());
|
|
|
List<CrawlerVideo> crawlerVideoList = crawlerVideoMapper.selectByExample(example);
|
|
|
- List<CrawlerVideo> videoList;
|
|
|
- switch (publishContent.getContentPoolType()) {
|
|
|
- case "autoArticlePoolLevel4":
|
|
|
- // 冷启层,全量做
|
|
|
- videoList = shuffleList(crawlerVideoList).subList(0, Math.min(crawlerVideoList.size(), 3));
|
|
|
- break;
|
|
|
- case "autoArticlePoolLevel3":
|
|
|
- //次条,只针对具体账号做
|
|
|
- if (ghIdMap.containsKey(planAccount.getGhId())) {
|
|
|
- videoList = shuffleList(crawlerVideoList).subList(0, Math.min(crawlerVideoList.size(), 3));
|
|
|
- } else {
|
|
|
- videoList = crawlerVideoList.subList(0, Math.min(crawlerVideoList.size(), 3));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "autoArticlePoolLevel1":
|
|
|
- // 头条,先不做
|
|
|
- videoList = crawlerVideoList.subList(0, Math.min(crawlerVideoList.size(), 3));
|
|
|
- break;
|
|
|
- default:
|
|
|
- videoList = crawlerVideoList.subList(0, Math.min(crawlerVideoList.size(), 3));
|
|
|
- break;
|
|
|
+ List<CrawlerVideo> videoList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(crawlerVideoList)) {
|
|
|
+ videoList.add(crawlerVideoList.get(0));
|
|
|
}
|
|
|
log.info("getContentMiniVideo videoList={}", videoList);
|
|
|
return videoList;
|
|
@@ -319,11 +301,4 @@ public class ContentServiceImpl implements ContentService {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
- private <T> List<T> shuffleList(List<T> oriList) {
|
|
|
- // 使用 ArrayList 创建副本
|
|
|
- List<T> shuffledList = new ArrayList<>(oriList);
|
|
|
- Collections.shuffle(shuffledList); // 随机打乱列表
|
|
|
- return shuffledList;
|
|
|
- }
|
|
|
-
|
|
|
}
|