Browse Source

只获取一个小程序

xueyiming 6 months ago
parent
commit
bc88ad9b39

+ 5 - 23
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/ContentServiceImpl.java

@@ -212,13 +212,13 @@ 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) {
+        if (CollectionUtils.isEmpty(contentMiniVideos)) {
             publicContentService.delPublishContent(publishContent);
             return new ArrayList<>();
         }
         List<VideoDetail> videoDetails = publishVideo(contentMiniVideos, matchVideo);
         log.info("getPublishVideoDetail videoDetails={}", videoDetails);
-        if (videoDetails.size() < 2) {
+        if (CollectionUtils.isEmpty(contentMiniVideos)) {
             publicContentService.delPublishContent(publishContent);
             return new ArrayList<>();
         }
@@ -283,27 +283,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;

+ 6 - 6
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -509,7 +509,7 @@ public class CoreServiceImpl implements CoreService {
                     List<VideoDetail> videoDetails = contentService.getPublishVideoDetail(publishContent, planAccount, matchVideo);
                     log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
                     publishMiniprogramList = getPublishMiniprogramList(videoDetails, planAccount, publishContent);
-                    if (CollectionUtils.isEmpty(publishMiniprogramList) || publishMiniprogramList.size() < 2) {
+                    if (CollectionUtils.isEmpty(publishMiniprogramList)) {
                         continue;
                     }
                     contentService.updateMatchContent(publishContent, publishMiniprogramList, matchVideo);
@@ -544,11 +544,11 @@ public class CoreServiceImpl implements CoreService {
         if (CollectionUtils.isEmpty(publishMiniprogramList)) {
             return null;
         }
-        if (!Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
-            if (publishMiniprogramList.size() < 2) {
-                return null;
-            }
-        }
+//        if (!Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
+//            if (publishMiniprogramList.size() < 2) {
+//                return null;
+//            }
+//        }
         for (PublishMiniprogram publishMiniprogram : publishMiniprogramList) {
             //插入rootSource
             rootSourceService.addRootSource(publishMiniprogram, planAccount, publishContent);