add 加了个打印测试数据入口

This commit is contained in:
zlzw 2024-11-30 16:37:50 +08:00
parent 313f8ac914
commit 23861a897f
2 changed files with 16 additions and 5 deletions

View File

@ -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")

View File

@ -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 {