From 0a18a8cb0a7a57bf1f82df425251334c57f8c39a Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 23 一月 2021 15:40:37 +0800
Subject: [PATCH] 新增手机号/qq/微信绑定

---
 src/test/java/com/hxh/spring/test/FunTV2.java |  154 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 98 insertions(+), 56 deletions(-)

diff --git a/src/test/java/com/hxh/spring/test/FunTV2.java b/src/test/java/com/hxh/spring/test/FunTV2.java
index 475cc1e..0eca29e 100644
--- a/src/test/java/com/hxh/spring/test/FunTV2.java
+++ b/src/test/java/com/hxh/spring/test/FunTV2.java
@@ -1,22 +1,21 @@
 package com.hxh.spring.test;
 
-import com.google.gson.Gson;
-import com.yeshi.buwan.dao.juhe.funtv.*;
-import com.yeshi.buwan.domain.ResourceVideo;
-import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg;
+import com.yeshi.buwan.dao.juhe.funtv.FunTVAlbum2Dao;
+import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao;
+import com.yeshi.buwan.dao.juhe.funtv.VideoFunTV2Dao;
+import com.yeshi.buwan.dao.juhe.funtv.VideoFunTVNewDao;
 import com.yeshi.buwan.funtv.FunTVNewApi;
 import com.yeshi.buwan.funtv.FunTVUtil;
-import com.yeshi.buwan.funtv.FunTVUtil2;
-import com.yeshi.buwan.funtv.entity.*;
-import com.yeshi.buwan.iqiyi.entity.VideoIqiyi;
+import com.yeshi.buwan.funtv.entity.FunTVAlbum2;
+import com.yeshi.buwan.funtv.entity.FunTVShortVideo2;
+import com.yeshi.buwan.funtv.entity.FunTVVideo2;
+import com.yeshi.buwan.funtv.entity.VideoFunTV2;
 import com.yeshi.buwan.job.video.FunTV2VideoUpdate;
 import com.yeshi.buwan.service.imp.ResourceVideoService;
 import com.yeshi.buwan.service.imp.VideoInfoService;
 import com.yeshi.buwan.service.inter.juhe.FunTV2Service;
 import com.yeshi.buwan.util.HtmlToolUtil;
-import com.yeshi.buwan.util.mq.CMQManager;
 import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO;
-import net.sf.json.JSONArray;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
@@ -24,9 +23,11 @@
 import org.springframework.test.context.web.WebAppConfiguration;
 
 import javax.annotation.Resource;
+import java.io.FileInputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Scanner;
 
 @RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯
 @ContextConfiguration(locations = {"classpath:spring.xml"})
@@ -56,24 +57,24 @@
 
     @Test
     public void test1() {
-        long now = System.currentTimeMillis();
-        for (int d = 200; d >= 100; d--) {
-            Funtv2ResultVO result = FunTVNewApi.getVideos(1, 20, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), 1013, 1);
-            if (result != null && result.getList() != null && result.getList().size() > 0)
-                System.out.println(result);
-        }
+//        long now = System.currentTimeMillis();
+//        for (int d = 200; d >= 100; d--) {
+//            Funtv2ResultVO result = FunTVNewApi.getVideos(1, 20, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), 1013, 1);
+//            if (result != null && result.getList() != null && result.getList().size() > 0)
+//                System.out.println(result);
+//        }
     }
 
     @Test
     public void syncAlbum() {
         //1-鐢靛奖 2-鐢佃鍓� 3-鍔ㄦ极 4-缁艰壓 5-灏戝効
-        int channelId = 5;
-        Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, channelId, 1);
+        int channelId = 2;
+        Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, 1);
         int totalCount = vo.getCount();
         int pageSize = 20;
         int totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
         for (int p = 0; p < totalPage; p++) {
-            Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, channelId, 1);
+            Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, 1);
             if (result != null)
                 for (Serializable a : result.getList()) {
                     FunTVAlbum2 album2 = (FunTVAlbum2) a;
@@ -86,48 +87,46 @@
     }
 
 
-    @Test
-    public void syncShortVideo() {
-        long now = System.currentTimeMillis();
-        for (int d = 30; d >= 0; d--) {
-            List<FunTVShortVideo2> shortVideo2List = new ArrayList<>();
-            int pageSize = 100;
-            Funtv2ResultVO result = FunTVNewApi.getVideos(1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1);
-            if (result != null) {
-                for (Serializable a : result.getList()) {
-                    FunTVShortVideo2 video2 = (FunTVShortVideo2) a;
-                    shortVideo2List.add(video2);
-                }
-            }
-            int count = result.getCount();
-            int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
-            if (totalPage > 1)
-                for (int p = 1; p < totalPage; p++) {
-                    result = FunTVNewApi.getVideos(p + 1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1);
-                    if (result != null) {
-                        for (Serializable a : result.getList()) {
-                            FunTVShortVideo2 video2 = (FunTVShortVideo2) a;
-                            shortVideo2List.add(video2);
-                        }
-                    }
-                }
-            for (FunTVShortVideo2 video2 : shortVideo2List) {
-                funTV2Service.saveShortVideo(video2);
-            }
-        }
-    }
-
-    @Test
-    public void getAlbumDetail() {
-        FunTVAlbum2 album2 = FunTVNewApi.getAlbumsDetail("99989");
-        System.out.println(album2);
-    }
+//    @Test
+//    public void syncShortVideo() {
+//        long now = System.currentTimeMillis();
+//        for (int d = 30; d >= 0; d--) {
+//            List<FunTVShortVideo2> shortVideo2List = new ArrayList<>();
+//            int pageSize = 100;
+//            Funtv2ResultVO result = FunTVNewApi.getVideos(1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1);
+//            if (result != null) {
+//                for (Serializable a : result.getList()) {
+//                    FunTVShortVideo2 video2 = (FunTVShortVideo2) a;
+//                    shortVideo2List.add(video2);
+//                }
+//            }
+//            int count = result.getCount();
+//            int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
+//            if (totalPage > 1)
+//                for (int p = 1; p < totalPage; p++) {
+//                    result = FunTVNewApi.getVideos(p + 1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1);
+//                    if (result != null) {
+//                        for (Serializable a : result.getList()) {
+//                            FunTVShortVideo2 video2 = (FunTVShortVideo2) a;
+//                            shortVideo2List.add(video2);
+//                        }
+//                    }
+//                }
+//            for (FunTVShortVideo2 video2 : shortVideo2List) {
+//                funTV2Service.saveShortVideo(video2);
+//            }
+//        }
+//    }
 
 
     @Test
     public void addToVideoInfo() {
-        List<FunTVAlbum2> album2List = funTVAlbum2Dao.listByChannelId(2, 0, 1000);
+        List<FunTVAlbum2> album2List = funTVAlbum2Dao.listByChannelId(3, 0, 1000);
         for (FunTVAlbum2 album2 : album2List) {
+            //鍙姞鍏ュ厤璐圭殑
+            if (!album2.getFeeMode().equalsIgnoreCase("0")) {
+                continue;
+            }
             System.out.println(album2.getName());
             List<FunTVVideo2> list = funTVVideo2Dao.listByMediaId(album2.getId(), 0, 2000);
             album2.setEpisodes(list);
@@ -189,7 +188,7 @@
         List<String[]> list = HtmlToolUtil.parseSQLYogExportHtmData("C:\\Users\\Administrator\\Desktop\\椋庤鑰佺増姝g墖.htm", 3);
         for (String[] sts : list) {
             String videoId = sts[0];
-            resourceVideoService.delete(videoId, FunTVUtil.RESOURCE_ID+"");
+            resourceVideoService.delete(videoId, FunTVUtil.RESOURCE_ID + "");
 //            List<VideoFunTV> list1 = videoFunTVNewDao.listByVideoId(Long.parseLong(videoId));
 //
 //            if (list1 != null)
@@ -198,4 +197,47 @@
         }
     }
 
+    @Test
+    public void removeAlbum() {
+        for (int i = 0; i < 100; i++) {
+            List<VideoFunTV2> list = videoFunTV2Dao.listAll(0, 100);
+            for (VideoFunTV2 tv2 : list) {
+                try {
+                    funTV2Service.offLineAlbum(tv2.getMediaId());
+                } catch (Exception e) {
+
+                }
+            }
+        }
+    }
+
+
+    public static void main(String[] args) {
+        String[] files = new String[]{
+                "video_play.2021-01-06.log", "video_play.2021-01-07.log", "video_play.2021-01-08.log", "video_play.2021-01-09.log", "video_play.2021-01-10.log", "video_play.2021-01-11.log", "video_play.2021-01-12.log", "video_play.2021-01-13.log", "video_play.2021-01-14.log"
+        };
+        for (String file : files) {
+            try {
+                List<String> list = getFunTVPlayData("C:\\Users\\Administrator\\Desktop\\鏃ュ織\\甯冧父鎾斁\\" + file);
+                System.out.println(list.size());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private static List<String> getFunTVPlayData(String path) throws Exception {
+        List<String> list = new ArrayList<>();
+
+        Scanner scanner = new Scanner(new FileInputStream(path));
+        while (scanner.hasNextLine()) {
+            String line = scanner.nextLine();
+            if (line.contains("playStatistic") && line.contains("#24")) {
+                list.add(line);
+            }
+        }
+        scanner.close();
+        return list;
+    }
+
 }

--
Gitblit v1.8.0