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 {