This commit is contained in:
Yutousama 2022-10-14 11:30:34 +08:00
parent 38d06bcadf
commit 6482c919f0
4 changed files with 17 additions and 5 deletions

View File

@ -8,7 +8,7 @@
<body> <body>
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="left: 0px;"> <div class="layui-body" style="left: 0px; overflow: auto;">
<div style="width: 50%;margin-left: 25%; margin-top: 2%;"> <div style="width: 50%;margin-left: 25%; margin-top: 2%;">
<blockquote class="layui-elem-quote"> <blockquote class="layui-elem-quote">
在这里添加需要监控的UP主添加请填入直播地址或房间号 在这里添加需要监控的UP主添加请填入直播地址或房间号
@ -263,7 +263,7 @@
udata.live = udata.live ? 1 : 0; udata.live = udata.live ? 1 : 0;
udata.saveDanmu = udata.saveDanmu ? 1 : 0; udata.saveDanmu = udata.saveDanmu ? 1 : 0;
console.log(udata) console.log(udata)
$.post("/upinfo/update.do", udata, function (json) { $.post("/upinfo/set/update.do", udata, function (json) {
layer.close(dialogIndex); layer.close(dialogIndex);
layer.msg(json.msg, function () { layer.msg(json.msg, function () {
window.location.reload(); window.location.reload();

View File

@ -69,6 +69,11 @@ public class UpInfoController {
return json; return json;
} }
@ResponseBody
@RequestMapping("/upinfo/update.do")
public JSONObject updateV1(BilibiliUpInfo upData) {
return update(upData);
}
@ResponseBody @ResponseBody
@RequestMapping("/upinfo/set/update.do") @RequestMapping("/upinfo/set/update.do")
public JSONObject update(BilibiliUpInfo upData) { public JSONObject update(BilibiliUpInfo upData) {
@ -132,6 +137,9 @@ public class UpInfoController {
JSONObject infoData = infoByUid.getJSONObject("data"); JSONObject infoData = infoByUid.getJSONObject("data");
for (BilibiliUpInfo up : list) { for (BilibiliUpInfo up : list) {
JSONObject user = infoData.getJSONObject(up.getMid() + ""); JSONObject user = infoData.getJSONObject(up.getMid() + "");
if(user==null){
continue;
}
up.setLive(user.getInteger("live_status")); up.setLive(user.getInteger("live_status"));
if (up.checkLiveStatus() == 1) { if (up.checkLiveStatus() == 1) {
online++; online++;

View File

@ -193,8 +193,12 @@ public class Live implements ApplicationContextAware {
Log.i(roomId + " 断开连接,重连..."); Log.i(roomId + " 断开连接,重连...");
try { try {
init = true; init = true;
heartBeattimer.cancel(); if(heartBeattimer!=null) {
client.close(); heartBeattimer.cancel();
}
if(client!=null) {
client.close();
}
start(); start();
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);

View File

@ -350,7 +350,7 @@ public class LiveUtils {
} }
public static long getMid(int roomId) { public static long getMid(int roomId) {
JSONObject http_get = http_get("http://api.live.bilibili.com/room/v1/Room/room_init?id=" + roomId); JSONObject http_get = http_get("https://api.live.bilibili.com/room/v1/Room/room_init?id=" + roomId);
if (http_get == null) { if (http_get == null) {
return -1; return -1;
} }