From 23861a897ff306bded08695e1ef03818bcfea8e7 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 30 Nov 2024 16:37:50 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=8A=A0=E4=BA=86=E4=B8=AA=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bilibili/Controllers/TestControllers.java | 15 ++++++++++++--- .../bilibili/services/LiveDatabasesService.java | 6 ++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java b/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java index a12d2d7..e9692c9 100644 --- a/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java +++ b/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java @@ -1,17 +1,26 @@ package com.yutou.bilibili.Controllers; +import com.yutou.bilibili.services.LiveDanmuService; +import com.yutou.bilibili.services.LiveDatabasesService; +import com.yutou.bilibili.services.LiveVideoDownloadService; import com.yutou.common.okhttp.HttpLoggingInterceptor; -import com.yutou.common.utils.FFmpegUtils; +import jakarta.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class TestControllers { - @RequestMapping("/root/all") + @Resource + LiveDatabasesService databasesService; + @Resource + LiveDanmuService danmuService; + @Resource + LiveVideoDownloadService videoDownloadService; + @RequestMapping("/test/database") @ResponseBody public String test(){ - return "hello world"; + return "缓存:"+databasesService.getCacheInfo()+", 弹幕数:"+danmuService.getLiveRoomList().size()+", 视频数:"+videoDownloadService.getDownloadTasks().size(); } @ResponseBody @RequestMapping("/root/log") diff --git a/src/main/java/com/yutou/bilibili/services/LiveDatabasesService.java b/src/main/java/com/yutou/bilibili/services/LiveDatabasesService.java index e5f3116..2498834 100644 --- a/src/main/java/com/yutou/bilibili/services/LiveDatabasesService.java +++ b/src/main/java/com/yutou/bilibili/services/LiveDatabasesService.java @@ -10,8 +10,7 @@ import lombok.Getter; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import java.util.HashMap; -import java.util.Map; +import java.util.Arrays; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -34,6 +33,9 @@ public class LiveDatabasesService { private LiveDatabasesService() { configDatabase = new BiliLiveConfigDatabase(); } + public String getCacheInfo() { + return "总数:"+liveDatabases.size()+","+ Arrays.toString(liveDatabases.asMap().keySet().toArray()); + } public BiliLiveDatabase getLiveDatabase(String roomId) { try {