diff --git a/src/views/manage/MusicRequestManage.vue b/src/views/open_live/MusicRequest.vue similarity index 100% rename from src/views/manage/MusicRequestManage.vue rename to src/views/open_live/MusicRequest.vue diff --git a/src/views/open_live/OpenLottery.vue b/src/views/open_live/OpenLottery.vue index 5cefcb1..5f0fa6b 100644 --- a/src/views/open_live/OpenLottery.vue +++ b/src/views/open_live/OpenLottery.vue @@ -152,19 +152,31 @@ function updateUsers() { } async function start() { if (!chatClient) { - const auth = await get() - if (auth) { - authResult.value = auth - } else { - return - } - initChatClient() + await connectRoom() isConnected.value = true setInterval(() => { - QueryPostAPI(OPEN_LIVE_API_URL + 'heartbeat', authInfo.value) + if (chatClient) { + QueryPostAPI(OPEN_LIVE_API_URL + 'heartbeat', authInfo.value).then((data) => { + if (data.code != 200) { + console.error('[OPEN-LIVE] 心跳失败: ' + data.message) + chatClient.stop() + chatClient = null + connectRoom() + } + }) + } }, 20 * 1000) } } +async function connectRoom() { + const auth = await get() + if (auth) { + authResult.value = auth + } else { + return + } + initChatClient() +} async function initChatClient() { chatClient = new ChatClientDirectOpenLive(authResult.value)