From 59a6641d503fa2b8db8d1032d1ebf3ed75a154f8 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 29 Nov 2024 11:01:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=82=B9=E9=87=8D=E7=BD=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=94=B9=E6=88=90=E4=BA=86=E5=AE=9A=E6=97=B6=E5=99=A8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yutou/bilibili/Tools/ApplicationTime.java | 22 +++++++++++++++++++ .../bilibili/services/SystemService.java | 5 ----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java diff --git a/src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java b/src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java new file mode 100644 index 0000000..56bca9d --- /dev/null +++ b/src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java @@ -0,0 +1,22 @@ +package com.yutou.bilibili.Tools; + +import com.yutou.bilibili.services.LiveDanmuService; +import com.yutou.bilibili.services.LiveVideoDownloadService; +import jakarta.annotation.Resource; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +@Component +@EnableScheduling +public class ApplicationTime { + @Resource + LiveVideoDownloadService videoService; + @Resource + LiveDanmuService danmuService; + @Scheduled(cron = "1 0 * * * *") + public void reset(){ + videoService.clearUserStopList(); + danmuService.clearUserList(); + } +} diff --git a/src/main/java/com/yutou/bilibili/services/SystemService.java b/src/main/java/com/yutou/bilibili/services/SystemService.java index 7429bd2..3c50861 100644 --- a/src/main/java/com/yutou/bilibili/services/SystemService.java +++ b/src/main/java/com/yutou/bilibili/services/SystemService.java @@ -37,7 +37,6 @@ public class SystemService { return config.getTimerLoop(); } - private final String resetTimer = "00:00:00 - 00:01:00"; public void start() { if (timer == null) { @@ -50,10 +49,6 @@ public class SystemService { scheduled = timer.scheduleAtFixedRate(() -> { List list = databasesService.getConfigDatabase().getAllConfig(); Log.i("循环任务:" + list.size()); - if (DateFormatUtils.getInstance().checkTime(null, resetTimer)) { - videoService.clearUserStopList(); - danmuService.clearUserList(); - } for (LiveConfigDatabaseBean bean : list) { try { // 如果bean需要录制弹幕,并且检查录制弹幕时间,并且不需要同步直播弹幕,则录制弹幕