Explorar el Código

去掉白名单逻辑 全部发3个小程序 小程序不足3个 用首个视频补全

xueyiming hace 1 mes
padre
commit
6d6ebb6dba

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

@@ -24,6 +24,7 @@ import com.tzld.piaoquan.longarticle.utils.LarkRobotUtil;
 import com.tzld.piaoquan.longarticle.utils.ToolUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -38,39 +39,6 @@ public class ContentServiceImpl implements ContentService {
 
     private final String SINGLE_VIDEO_UID = "76862180";
 
-    private static final List<String> multipleVideoPlanIdList = new ArrayList<String>() {{
-        add("20250208065525959973866");
-        add("20250208111811026884434");
-        add("20250212125646224172850");
-        add("20250213023808593788754");
-        add("20250213091337867990118");
-        add("20250214091843879629665");
-        add("20250214122110960857913");
-        add("20250217080347557694800");
-        add("20250217120153840400833");
-        add("20250304073234245880032");
-    }};
-
-    private static final List<String> multipleVideoGhIdList = new ArrayList<String>() {{
-        add("gh_f93af770fb55");
-        add("gh_325188c9ea8b");
-        add("gh_26c906592150");
-        add("gh_18c6258ec8f7");
-        add("gh_631fb48b83a5");
-        add("gh_86cb64d57a1d");
-        add("gh_74827e516740");
-        add("gh_fe6ef3a65a48");
-        add("gh_be0aa7c09379");
-        add("gh_4f34eb52e641");
-        add("gh_9bd3ec87db86");
-        add("gh_b1553fe3ef26");
-        add("gh_1a2bb3fef76a");
-        add("gh_c952bc10dfad");
-        add("gh_871c78fca0fa");
-        add("gh_c19a94a3fcc1");
-    }};
-
-
     @Autowired
     private MatchVideoMapper matchVideoMapper;
 
@@ -381,24 +349,25 @@ public class ContentServiceImpl implements ContentService {
                 criteria.andStatusNotEqualTo(2).andIsIllegalEqualTo(0);
             }
             List<CrawlerVideo> crawlerVideoList = crawlerVideoMapper.selectByExample(example);
+            if (CollectionUtils.isEmpty(crawlerVideoList)) {
+                return null;
+            }
             if (planAccount == null) {
                 return crawlerVideoList;
             }
-
-            //临时逻辑  该计划返回正常数量小程序
-            if (multipleVideoPlanIdList.contains(planAccount.getPlanId())
-                    || multipleVideoGhIdList.contains(planAccount.getGhId())) {
-                if (crawlerVideoList.size() > 3) {
-                    return crawlerVideoList.subList(0, 3);
+            if (crawlerVideoList.size() < 3) {
+                CrawlerVideo crawlerVideo = crawlerVideoList.get(0);
+                int needAddCount = 3 - crawlerVideoList.size();
+                for (int i = 0; i < needAddCount; i++) {
+                    CrawlerVideo copyCrawlerVideo = new CrawlerVideo();
+                    BeanUtils.copyProperties(crawlerVideo, copyCrawlerVideo);
+                    crawlerVideoList.add(copyCrawlerVideo);
                 }
-                return crawlerVideoList;
             }
-            List<CrawlerVideo> videoList = new ArrayList<>();
-            if (!CollectionUtils.isEmpty(crawlerVideoList)) {
-                videoList.add(crawlerVideoList.get(0));
+            if (crawlerVideoList.size() > 3) {
+                return crawlerVideoList.subList(0, 3);
             }
-            log.info("getContentMiniVideo videoList={}", videoList);
-            return videoList;
+            return crawlerVideoList;
         } catch (Exception e) {
             log.error("getContentMiniVideo error", e);
         }