From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 20 二月 2025 16:57:55 +0800
Subject: [PATCH] IOS广告增加区域屏蔽

---
 src/main/java/com/yeshi/buwan/job/video/TencentVideoUpdate.java |   73 ++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/job/video/TencentVideoUpdate.java b/src/main/java/com/yeshi/buwan/job/video/TencentVideoUpdate.java
index ba6ba0f..9f6d3c5 100644
--- a/src/main/java/com/yeshi/buwan/job/video/TencentVideoUpdate.java
+++ b/src/main/java/com/yeshi/buwan/job/video/TencentVideoUpdate.java
@@ -2,15 +2,13 @@
 
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
-import com.yeshi.buwan.mogotv.MogoTVApiUtil;
-import com.yeshi.buwan.mogotv.entity.MogoTVClipInfo;
-import com.yeshi.buwan.mogotv.entity.MogoTVVideo;
-import com.yeshi.buwan.service.inter.juhe.MogoTVService;
 import com.yeshi.buwan.service.inter.juhe.TencentVideoService;
-import com.yeshi.buwan.tencent.TencentVideoApiUtil;
-import com.yeshi.buwan.tencent.TencentVideoUtil;
-import com.yeshi.buwan.tencent.entity.TencentCoverInfo;
 import com.yeshi.buwan.util.StringUtil;
+import com.yeshi.buwan.videos.tencent.TencentVideoApiUtil;
+import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo;
+import com.yeshi.buwan.videos.tencent.factory.TencentCoverInfoFactory;
+import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO;
+import net.sf.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -21,47 +19,39 @@
 @Component
 public class TencentVideoUpdate {
 
-    private final static Logger logger = LoggerFactory.getLogger(TencentVideoUpdate.class);
+    private final static Logger logger = LoggerFactory.getLogger("debug");
 
     @Resource
     private TencentVideoService tencentVideoService;
 
 
     private TencentCoverInfo getCoverDetail(String coverId) throws Exception {
-        TencentCoverInfo detail = TencentVideoApiUtil.getCoverInfo(String.format("https://v.qq.com/x/cover/%s.html", coverId));
-        return detail;
+        TencentCoverInfoVO detail = TencentVideoApiUtil.getCoverInfo(String.format("https://v.qq.com/x/cover/%s.html", coverId));
+        return TencentCoverInfoFactory.create(detail);
     }
 
-    private void updateCategory(String channel) {
-        int totalPage = 50;
-        for (int i = 0; i < totalPage; i++) {
-            List<TencentCoverInfo> coverInfoList = TencentVideoApiUtil.getVideoListByCategory(channel, i + 1);
-            for (TencentCoverInfo coverInfo : coverInfoList) {
-                System.out.println(coverInfo.getTitle()+":"+coverInfo.getCover_id());
+    public void updateCategory(String channel,int startPage,int endPage, Integer areaId) {
+        logger.info("鏇存柊鍒嗙被锛�"+channel);
+        for (int i = startPage; i <= endPage; i++) {
+            List<TencentCoverInfoVO> coverInfoList = TencentVideoApiUtil.getVideoListByCategory(channel, i, areaId);
+            save(coverInfoList);
+        }
+    }
+
+    private void save(List<TencentCoverInfoVO> coverInfoList) {
+        if (coverInfoList != null)
+            for (TencentCoverInfoVO coverInfo : coverInfoList) {
+                System.out.println(coverInfo.getTitle() + ":" + coverInfo.getCover_id());
                 try {
-                    tencentVideoService.save(coverInfo);
+//                    tencentVideoService.save(TencentCoverInfoFactory.create(coverInfo));
+                    tencentVideoService.addToInternetSearch( TencentCoverInfoFactory.create(coverInfo),true);
                 } catch (Exception e) {
                     e.printStackTrace();
+                    logger.error("淇濆瓨鍑洪敊",e);
                 }
             }
-        }
     }
 
-    private String getChannel(String cate) throws Exception {
-        switch (cate) {
-            case "缁艰壓":
-                return "variety";
-            case "鐢靛奖":
-                return "movie";
-            case "鐢佃鍓�":
-                return "tv";
-            case "鍔ㄦ极":
-                return "cartoon";
-        }
-
-        throw new Exception("绫诲瀷涓嶅尮閰�");
-
-    }
 
     /**
      * 鏇存柊鏈�杩戝嚑澶╃殑瑙嗛
@@ -77,12 +67,23 @@
         };
 
         if (!StringUtil.isNullOrEmpty(param)) {
-            updateCategory(getChannel(param));
+            updateCategory(param,1,1,null);
         } else {
             for (String type : types) {
-                updateCategory(getChannel(type));
+                updateCategory(type,1,1, null);
             }
         }
+        return ReturnT.SUCCESS;
+    }
+
+
+    @XxlJob("video-update-tencent-updateVideo-byweburl")
+    public ReturnT<String> updateLatestVideoByWebUrl(String param) throws Exception {
+        JSONObject json = JSONObject.fromObject(param);
+        int page = json.optInt("page");
+        String url = json.optString("url");
+//        List<TencentCoverInfoVO> list = TencentVideoApiUtil.getVideoList(TencentWebUtil.getApiUrl(url, page));
+//        save(list);
         return ReturnT.SUCCESS;
     }
 
@@ -100,7 +101,7 @@
         for (String cid : cids) {
             try {
                 TencentCoverInfo detail = getCoverDetail(cid);
-                tencentVideoService.save(detail);
+                tencentVideoService.addToInternetSearch(detail, true);
             } catch (Exception e) {
                 e.printStackTrace();
             }

--
Gitblit v1.8.0