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>
<div class="layui-layout layui-layout-admin">
<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%;">
<blockquote class="layui-elem-quote">
在这里添加需要监控的UP主添加请填入直播地址或房间号
@ -263,7 +263,7 @@
udata.live = udata.live ? 1 : 0;
udata.saveDanmu = udata.saveDanmu ? 1 : 0;
console.log(udata)
$.post("/upinfo/update.do", udata, function (json) {
$.post("/upinfo/set/update.do", udata, function (json) {
layer.close(dialogIndex);
layer.msg(json.msg, function () {
window.location.reload();

View File

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

View File

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

View File

@ -350,7 +350,7 @@ public class LiveUtils {
}
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) {
return -1;
}