Explorar o código

调整获取视频

yumeng %!s(int64=5) %!d(string=hai) anos
pai
achega
234890401d

+ 44 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -254,6 +254,50 @@ public class TestController {
         return "Success";
     }
 
+
+    @GetMapping(value = "/getVideoByAccountId")
+    public String getVideoByAccountId(Long accountId) throws IOException {
+
+        try {
+
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("media_id", 2);
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    CtopOauthToken one = tokenService.getOne(tokenQueryWrapper);
+                    try {
+                        kuaishouInterfaceService.getSuZaoList(one.getAccessToken(), one.getAccountId(), 1);
+                        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                        String videoEndDate = DateUtils.addDay(nowDate, -180);
+                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                        Date end = simpleDateFormat.parse(nowDate);
+                        Date start = simpleDateFormat.parse(videoEndDate);
+                        List<Date> dates = DateUtils.findDates(start, end);
+                        for (int i = 0; i < dates.size(); i++) {
+                            String formatDate = simpleDateFormat.format(dates.get(i));
+                            kuaishouInterfaceService.getVideoList(one, formatDate);
+                            kuaishouInterfaceService.getImageList(one, formatDate);
+                            Thread.sleep(100);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+
+
+                    log.info("快手物料数据同步完成");
+                }
+            };
+            thread.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "Success";
+    }
+
+
     @GetMapping(value = "/createCutTask")
     public String createCutTask(String startDate, String endDate) throws IOException {
 
@@ -477,8 +521,6 @@ public class TestController {
     }
 
 
-
-
     @GetMapping(value = "/gerCreative")
     public void gerCreative() {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();