feat: 迁移自定义功能至 1.5.9.9 版本

包含音乐源限制、CI 防 OOM 优化、数据库连接池优化、管理端权限及 UI 细节定制等功能
This commit is contained in:
2026-09-12 19:26:42 +08:00
parent 34f0679117
commit 1106aeea6c
161 changed files with 18963 additions and 27900 deletions
+35 -1
View File
@@ -1,4 +1,5 @@
import { db } from '~/drizzle/db'
import { CacheService } from '../../../services/cacheService'
import { playTimes, schedules, songs } from '~/drizzle/schema'
import { and, count, eq, ne } from 'drizzle-orm'
@@ -13,7 +14,7 @@ export default defineEventHandler(async (event) => {
})
}
if (!['SONG_ADMIN', 'ADMIN', 'SUPER_ADMIN'].includes(user.role)) {
if (!['ADMIN', 'SUPER_ADMIN'].includes(user.role)) {
throw createError({
statusCode: 403,
message: '只有管理员才能访问播出时段'
@@ -120,6 +121,16 @@ export default defineEventHandler(async (event) => {
.returning()
const updatedPlayTime = updatedPlayTimeResult[0]
// 清除相关缓存
try {
const cacheService = CacheService.getInstance()
await cacheService.clearSchedulesCache()
await cacheService.clearPlayTimesCache()
console.log('[Cache] 排期缓存已清除(播放时间更新)')
} catch (cacheError) {
console.warn('[Cache] 清除缓存失败:', cacheError)
}
return updatedPlayTime
} catch (error: any) {
console.error('更新播出时段失败:', error)
@@ -172,6 +183,16 @@ export default defineEventHandler(async (event) => {
.returning()
const updatedPlayTime = updatedPlayTimeResult[0]
// 清除相关缓存
try {
const cacheService = CacheService.getInstance()
await cacheService.clearSchedulesCache()
await cacheService.clearPlayTimesCache()
console.log('[Cache] 排期缓存已清除(播放时间部分更新)')
} catch (cacheError) {
console.warn('[Cache] 清除缓存失败:', cacheError)
}
return updatedPlayTime
} catch (error: any) {
console.error('部分更新播出时段失败:', error)
@@ -220,6 +241,19 @@ export default defineEventHandler(async (event) => {
await db.update(schedules).set({ playTimeId: null }).where(eq(schedules.playTimeId, id))
}
// 清除相关缓存
try {
const cacheService = CacheService.getInstance()
await cacheService.clearSchedulesCache()
await cacheService.clearPlayTimesCache()
if (songsCount > 0) {
await cacheService.clearSongsCache()
}
console.log('[Cache] 缓存已清除(播放时间删除)')
} catch (cacheError) {
console.warn('[Cache] 清除缓存失败:', cacheError)
}
return {
message: '播出时段已成功删除',
affected: { songs: songsCount, schedules: schedulesCount }