mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-11 21:06:56 +08:00
update url
This commit is contained in:
@@ -180,7 +180,7 @@ const table = ref()
|
||||
async function getAllSong() {
|
||||
if (accountInfo.value) {
|
||||
try {
|
||||
const data = await QueryGetAPI<SongRequestInfo[]>(SONG_REQUEST_API_URL + 'get-all', {
|
||||
const data = await QueryGetAPI<SongRequestInfo[]>(SONG_REQUEST_API_URL() + 'get-all', {
|
||||
id: accountInfo.value.id,
|
||||
})
|
||||
if (data.code == 200) {
|
||||
@@ -191,7 +191,6 @@ async function getAllSong() {
|
||||
return []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
message.error('无法获取数据')
|
||||
}
|
||||
return []
|
||||
@@ -202,26 +201,22 @@ async function getAllSong() {
|
||||
async function addSong(danmaku: EventModel) {
|
||||
console.log(`[OPEN-LIVE-Song-Request] 收到 [${danmaku.name}] 的点歌${danmaku.type == EventDataTypes.SC ? 'SC' : '弹幕'}: ${danmaku.msg}`)
|
||||
if (accountInfo.value) {
|
||||
await QueryPostAPI<SongRequestInfo>(SONG_REQUEST_API_URL + 'try-add', danmaku)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`[${danmaku.name}] 添加曲目: ${data.data.songName}`)
|
||||
if (data.message != 'EventFetcher') originSongs.value.unshift(data.data)
|
||||
} else {
|
||||
//message.error(`[${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
const time = Date.now()
|
||||
notice.warning({
|
||||
title: danmaku.name + ' 点歌失败',
|
||||
description: data.message,
|
||||
duration: isWarnMessageAutoClose.value ? 3000 : 0,
|
||||
meta: () => h(NTime, { type: 'relative', time: time, key: updateKey.value }),
|
||||
})
|
||||
console.log(`[OPEN-LIVE-Song-Request] [${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
await QueryPostAPI<SongRequestInfo>(SONG_REQUEST_API_URL() + 'try-add', danmaku).then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`[${danmaku.name}] 添加曲目: ${data.data.songName}`)
|
||||
if (data.message != 'EventFetcher') originSongs.value.unshift(data.data)
|
||||
} else {
|
||||
//message.error(`[${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
const time = Date.now()
|
||||
notice.warning({
|
||||
title: danmaku.name + ' 点歌失败',
|
||||
description: data.message,
|
||||
duration: isWarnMessageAutoClose.value ? 3000 : 0,
|
||||
meta: () => h(NTime, { type: 'relative', time: time, key: updateKey.value }),
|
||||
})
|
||||
console.log(`[OPEN-LIVE-Song-Request] [${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const songData = {
|
||||
songName: danmaku.msg.trim().substring(settings.value.orderPrefix.length),
|
||||
@@ -251,22 +246,18 @@ async function addSongManual() {
|
||||
return
|
||||
}
|
||||
if (accountInfo.value) {
|
||||
await QueryPostAPIWithParams<SongRequestInfo>(SONG_REQUEST_API_URL + 'add', {
|
||||
await QueryPostAPIWithParams<SongRequestInfo>(SONG_REQUEST_API_URL() + 'add', {
|
||||
name: newSongName.value,
|
||||
}).then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`已手动添加曲目: ${data.data.songName}`)
|
||||
originSongs.value.unshift(data.data)
|
||||
newSongName.value = ''
|
||||
console.log(`[OPEN-LIVE-Song-Request] 已手动添加曲目: ${data.data.songName}`)
|
||||
} else {
|
||||
message.error(`手动添加曲目失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`已手动添加曲目: ${data.data.songName}`)
|
||||
originSongs.value.unshift(data.data)
|
||||
newSongName.value = ''
|
||||
console.log(`[OPEN-LIVE-Song-Request] 已手动添加曲目: ${data.data.songName}`)
|
||||
} else {
|
||||
message.error(`手动添加曲目失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
} else {
|
||||
const songData = {
|
||||
songName: newSongName.value,
|
||||
@@ -309,7 +300,7 @@ async function updateSongStatus(song: SongRequestInfo, status: SongRequestStatus
|
||||
statusString2 = '演唱中'
|
||||
break
|
||||
}
|
||||
await QueryGetAPI(SONG_REQUEST_API_URL + statusString, {
|
||||
await QueryGetAPI(SONG_REQUEST_API_URL() + statusString, {
|
||||
id: song.id,
|
||||
})
|
||||
.then((data) => {
|
||||
@@ -326,7 +317,6 @@ async function updateSongStatus(song: SongRequestInfo, status: SongRequestStatus
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error(`更新曲目状态失败`)
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -400,7 +390,6 @@ async function onUpdateFunctionEnable() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error(`点歌功能${accountInfo.value?.settings.enableFunctions.includes(FunctionTypes.SongRequest) ? '启用' : '禁用'}失败: ${err}`)
|
||||
})
|
||||
}
|
||||
@@ -408,7 +397,7 @@ async function onUpdateFunctionEnable() {
|
||||
async function updateSettings() {
|
||||
if (accountInfo.value) {
|
||||
isLoading.value = true
|
||||
await QueryPostAPI(SONG_REQUEST_API_URL + 'update-setting', settings.value)
|
||||
await QueryPostAPI(SONG_REQUEST_API_URL() + 'update-setting', settings.value)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已保存')
|
||||
@@ -417,7 +406,6 @@ async function updateSettings() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('保存失败')
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -438,16 +426,14 @@ async function deleteSongs(values: SongRequestInfo[]) {
|
||||
originSongs.value = originSongs.value.filter((s) => !values.includes(s))
|
||||
} else {
|
||||
message.error('删除失败: ' + data.message)
|
||||
console.error('删除失败: ' + data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('删除失败')
|
||||
})
|
||||
}
|
||||
async function deactiveAllSongs() {
|
||||
await QueryGetAPI(SONG_REQUEST_API_URL + 'deactive')
|
||||
await QueryGetAPI(SONG_REQUEST_API_URL() + 'deactive')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已全部取消')
|
||||
@@ -461,7 +447,6 @@ async function deactiveAllSongs() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('取消失败')
|
||||
})
|
||||
}
|
||||
@@ -666,7 +651,7 @@ function GetGuardColor(level: number | null | undefined): string {
|
||||
async function updateActive() {
|
||||
if (!accountInfo.value) return
|
||||
try {
|
||||
const data = await QueryGetAPI<SongRequestInfo[]>(SONG_REQUEST_API_URL + 'get-active', {
|
||||
const data = await QueryGetAPI<SongRequestInfo[]>(SONG_REQUEST_API_URL() + 'get-active', {
|
||||
id: accountInfo.value?.id,
|
||||
})
|
||||
if (data.code == 200) {
|
||||
@@ -685,9 +670,7 @@ async function updateActive() {
|
||||
message.error('无法获取点歌队列: ' + data.message)
|
||||
return []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
const isLrcLoading = ref('')
|
||||
|
||||
|
||||
@@ -104,25 +104,23 @@ const props = defineProps<{
|
||||
|
||||
async function getUsers() {
|
||||
try {
|
||||
const data = await QueryGetAPI<UpdateLiveLotteryUsersModel>(LOTTERY_API_URL + 'live/get-users', {
|
||||
const data = await QueryGetAPI<UpdateLiveLotteryUsersModel>(LOTTERY_API_URL() + 'live/get-users', {
|
||||
code: props.code,
|
||||
})
|
||||
if (data.code == 200) {
|
||||
return data.data
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
} catch (err) {}
|
||||
return null
|
||||
}
|
||||
function updateUsers() {
|
||||
QueryPostAPI(LOTTERY_API_URL + 'live/update-users', {
|
||||
QueryPostAPI(LOTTERY_API_URL() + 'live/update-users', {
|
||||
code: props.code,
|
||||
users: originUsers.value,
|
||||
resultUsers: resultUsers.value,
|
||||
type: isLotteried.value ? OpenLiveLotteryType.Result : OpenLiveLotteryType.Waiting,
|
||||
}).catch((err) => {
|
||||
console.error('[OPEN-LIVE-Lottery] 更新历史抽奖用户失败: ' + err)
|
||||
console.error('[OPEN-LIVE-Lottery] 更新历史抽奖用户失败')
|
||||
})
|
||||
}
|
||||
function addUser(user: OpenLiveLotteryUserInfo, danmu: any) {
|
||||
@@ -213,7 +211,6 @@ function startLottery() {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
message.error('发生错误')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ const table = ref()
|
||||
async function getAll() {
|
||||
if (accountInfo.value) {
|
||||
try {
|
||||
const data = await QueryGetAPI<ResponseQueueModel[]>(QUEUE_API_URL + 'get-all', {
|
||||
const data = await QueryGetAPI<ResponseQueueModel[]>(QUEUE_API_URL() + 'get-all', {
|
||||
id: accountInfo.value.id,
|
||||
})
|
||||
if (data.code == 200) {
|
||||
@@ -202,7 +202,6 @@ async function getAll() {
|
||||
return []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
message.error('无法获取数据')
|
||||
}
|
||||
return []
|
||||
@@ -216,37 +215,33 @@ async function add(danmaku: EventModel) {
|
||||
}
|
||||
console.log(`[OPEN-LIVE-QUEUE] 收到 [${danmaku.name}] 的排队请求`)
|
||||
if (accountInfo.value) {
|
||||
await QueryPostAPI<ResponseQueueModel>(QUEUE_API_URL + 'try-add', danmaku)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
if (data.message != 'EventFetcher') {
|
||||
//如果存在则替换, 否则插入最后
|
||||
const index = originQueue.value.findIndex((q) => q.id == data.data.id)
|
||||
if (index > -1) {
|
||||
message.info(
|
||||
`${data.data.user?.name} 通过发送礼物再次付费: ¥ ${((data.data?.giftPrice ?? 0) - (originQueue.value[index]?.giftPrice ?? 0)).toFixed(1)}, 当前总计付费: ¥ ${data.data.giftPrice}`
|
||||
)
|
||||
originQueue.value.splice(index, 1, data.data)
|
||||
} else {
|
||||
originQueue.value.push(data.data)
|
||||
message.success(`[${danmaku.name}] 添加至队列`)
|
||||
}
|
||||
await QueryPostAPI<ResponseQueueModel>(QUEUE_API_URL() + 'try-add', danmaku).then((data) => {
|
||||
if (data.code == 200) {
|
||||
if (data.message != 'EventFetcher') {
|
||||
//如果存在则替换, 否则插入最后
|
||||
const index = originQueue.value.findIndex((q) => q.id == data.data.id)
|
||||
if (index > -1) {
|
||||
message.info(
|
||||
`${data.data.user?.name} 通过发送礼物再次付费: ¥ ${((data.data?.giftPrice ?? 0) - (originQueue.value[index]?.giftPrice ?? 0)).toFixed(1)}, 当前总计付费: ¥ ${data.data.giftPrice}`
|
||||
)
|
||||
originQueue.value.splice(index, 1, data.data)
|
||||
} else {
|
||||
originQueue.value.push(data.data)
|
||||
message.success(`[${danmaku.name}] 添加至队列`)
|
||||
}
|
||||
} else {
|
||||
//message.error(`[${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
const time = Date.now()
|
||||
notice.warning({
|
||||
title: danmaku.name + ' 排队失败',
|
||||
description: data.message,
|
||||
duration: isWarnMessageAutoClose.value ? 3000 : 0,
|
||||
meta: () => h(NTime, { type: 'relative', time: time, key: updateKey.value }),
|
||||
})
|
||||
console.log(`[OPEN-LIVE-QUEUE] [${danmaku.name}] 排队失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
} else {
|
||||
//message.error(`[${danmaku.name}] 添加曲目失败: ${data.message}`)
|
||||
const time = Date.now()
|
||||
notice.warning({
|
||||
title: danmaku.name + ' 排队失败',
|
||||
description: data.message,
|
||||
duration: isWarnMessageAutoClose.value ? 3000 : 0,
|
||||
meta: () => h(NTime, { type: 'relative', time: time, key: updateKey.value }),
|
||||
})
|
||||
console.log(`[OPEN-LIVE-QUEUE] [${danmaku.name}] 排队失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const songData = {
|
||||
status: QueueStatus.Waiting,
|
||||
@@ -274,22 +269,18 @@ async function addManual() {
|
||||
return
|
||||
}
|
||||
if (accountInfo.value) {
|
||||
await QueryPostAPIWithParams<ResponseQueueModel>(QUEUE_API_URL + 'add', {
|
||||
await QueryPostAPIWithParams<ResponseQueueModel>(QUEUE_API_URL() + 'add', {
|
||||
name: newQueueName.value,
|
||||
}).then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`已手动添加用户至队列: ${data.data.user?.name}`)
|
||||
originQueue.value.unshift(data.data)
|
||||
newQueueName.value = ''
|
||||
console.log(`[OPEN-LIVE-QUEUE] 已手动添加用户至队列: ${data.data.user?.name}`)
|
||||
} else {
|
||||
message.error(`手动添加失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`已手动添加用户至队列: ${data.data.user?.name}`)
|
||||
originQueue.value.unshift(data.data)
|
||||
newQueueName.value = ''
|
||||
console.log(`[OPEN-LIVE-QUEUE] 已手动添加用户至队列: ${data.data.user?.name}`)
|
||||
} else {
|
||||
message.error(`手动添加失败: ${data.message}`)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
} else {
|
||||
const songData = {
|
||||
status: QueueStatus.Waiting,
|
||||
@@ -311,7 +302,7 @@ async function updateStatus(queueData: ResponseQueueModel, status: QueueStatus)
|
||||
return
|
||||
}
|
||||
isLoading.value = true
|
||||
await QueryGetAPI(QUEUE_API_URL + 'set-status', {
|
||||
await QueryGetAPI(QUEUE_API_URL() + 'set-status', {
|
||||
id: queueData.id,
|
||||
status: status,
|
||||
})
|
||||
@@ -329,7 +320,6 @@ async function updateStatus(queueData: ResponseQueueModel, status: QueueStatus)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error(`更新队列状态失败`)
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -427,7 +417,6 @@ async function onUpdateFunctionEnable() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error(`队列功能${accountInfo.value?.settings.enableFunctions.includes(FunctionTypes.SongRequest) ? '启用' : '禁用'}失败: ${err}`)
|
||||
})
|
||||
}
|
||||
@@ -435,7 +424,7 @@ async function onUpdateFunctionEnable() {
|
||||
async function updateSettings() {
|
||||
if (accountInfo.value) {
|
||||
isLoading.value = true
|
||||
await QueryPostAPI(QUEUE_API_URL + 'update-setting', settings.value)
|
||||
await QueryPostAPI(QUEUE_API_URL() + 'update-setting', settings.value)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已保存')
|
||||
@@ -444,7 +433,6 @@ async function updateSettings() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('保存失败')
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -469,12 +457,11 @@ async function deleteQueue(values: ResponseQueueModel[]) {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('删除失败')
|
||||
})
|
||||
}
|
||||
async function deactiveAllSongs() {
|
||||
await QueryGetAPI(QUEUE_API_URL + 'deactive')
|
||||
await QueryGetAPI(QUEUE_API_URL() + 'deactive')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已全部取消')
|
||||
@@ -488,7 +475,6 @@ async function deactiveAllSongs() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
message.error('取消失败')
|
||||
})
|
||||
}
|
||||
@@ -677,7 +663,7 @@ function GetGuardColor(level: number | null | undefined): string {
|
||||
async function updateActive() {
|
||||
if (!accountInfo.value) return
|
||||
try {
|
||||
const data = await QueryGetAPI<ResponseQueueModel[]>(QUEUE_API_URL + 'get-active', {
|
||||
const data = await QueryGetAPI<ResponseQueueModel[]>(QUEUE_API_URL() + 'get-active', {
|
||||
id: accountInfo.value?.id,
|
||||
})
|
||||
if (data.code == 200) {
|
||||
@@ -700,9 +686,7 @@ async function updateActive() {
|
||||
message.error('无法获取队列: ' + data.message)
|
||||
return []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
let timer: any
|
||||
let updateActiveTimer: any
|
||||
@@ -989,14 +973,14 @@ onUnmounted(() => {
|
||||
/>
|
||||
</NSpace>
|
||||
<span>
|
||||
<NRadioGroup v-model:value="settings.giftFilterType" :disabled="!configCanEdit">
|
||||
<NRadioGroup v-model:value="settings.giftFilterType" :disabled="!configCanEdit" @update:value="updateSettings">
|
||||
<NRadioButton :value="QueueGiftFilterType.And"> 需同时满足礼物名和价格 </NRadioButton>
|
||||
<NRadioButton :value="QueueGiftFilterType.Or"> 礼物名/价格 二选一 </NRadioButton>
|
||||
</NRadioGroup>
|
||||
</span>
|
||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit"> 在队列中时继续发送礼物会叠加 </NCheckbox>
|
||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit"> 在队列中时允许发送任意礼物来增加付费量 </NCheckbox>
|
||||
</template>
|
||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit"> 在队列中时允许继续发送礼物累计付费量 (仅限上方设定的礼物) </NCheckbox>
|
||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit"> 允许发送任意礼物来叠加付费量 </NCheckbox>
|
||||
</NSpace>
|
||||
<NDivider> 冷却 (单位: 秒) </NDivider>
|
||||
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings" :disabled="!configCanEdit"> 启用排队冷却 </NCheckbox>
|
||||
|
||||
Reference in New Issue
Block a user