新增了关键词检测

新增了手动暂停的恢复
This commit is contained in:
2024-11-29 15:45:29 +08:00
parent 31dd9cf1a1
commit e4e5696b70
11 changed files with 298 additions and 33 deletions

View File

@@ -1,5 +1,6 @@
package com.yutou.bilibili.Controllers;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.yutou.bilibili.datas.ResultData;
import com.yutou.bilibili.services.LiveDanmuService;
@@ -10,6 +11,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
public class LiveController {
@Resource
@@ -22,13 +25,31 @@ public class LiveController {
@RequestMapping("/live/list")
@ResponseBody
public JSONObject getLiveList(int page,int limit) {
return ResultData.success(liveService.getLiveList(page,limit), liveService.getConfigCount());
public JSONObject getLiveList(int page, int limit) {
List<JSONObject> list = liveService.getLiveList(page, limit).stream().map(it -> {
JSONObject json = JSONObject.parseObject(JSON.toJSONString(it));
if (videoService.isUserStopList(it.getRoomId())) {
json.put("videoListen", "已暂停");
} else if (it.isDownloadVideo()) {
json.put("videoListen", "录制中");
} else {
json.put("videoListen", "待机中");
}
if (danmuService.isUserStopList(it.getRoomId())) {
json.put("danmuListen", "已暂停");
} else if (it.isDanmu()) {
json.put("danmuListen", "录制中");
} else {
json.put("danmuListen", "待机中");
}
return json;
}).toList();
return ResultData.success(list, liveService.getConfigCount());
}
@RequestMapping("/live/gift/info")
@ResponseBody
public JSONObject download(String roomId, String videoId) {
return ResultData.success(liveService.getGiftInfo(roomId,videoId));
return ResultData.success(liveService.getGiftInfo(roomId, videoId));
}
}