初次提交
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { db } from './app/drizzle/db'
|
||||
import { systemSettings } from './app/drizzle/schema'
|
||||
import { CacheService } from './server/services/cacheService'
|
||||
|
||||
async function updateLogos() {
|
||||
try {
|
||||
// 检查是否存在系统设置
|
||||
const existingSettings = await db.select().from(systemSettings).limit(1)
|
||||
|
||||
if (existingSettings.length > 0) {
|
||||
await db.update(systemSettings).set({
|
||||
siteLogoUrl: '/images/site-logo.png',
|
||||
schoolLogoHomeUrl: '/images/school-logo-white.png',
|
||||
schoolLogoPrintUrl: '/images/school-logo-transparent.png'
|
||||
})
|
||||
console.log('Successfully updated existing settings')
|
||||
} else {
|
||||
await db.insert(systemSettings).values({
|
||||
siteLogoUrl: '/images/site-logo.png',
|
||||
schoolLogoHomeUrl: '/images/school-logo-white.png',
|
||||
schoolLogoPrintUrl: '/images/school-logo-transparent.png'
|
||||
})
|
||||
console.log('Successfully inserted new settings')
|
||||
}
|
||||
|
||||
// 清理缓存
|
||||
const cacheService = CacheService.getInstance()
|
||||
await cacheService.clearSystemSettingsCache()
|
||||
console.log('Successfully cleared cache')
|
||||
} catch (error) {
|
||||
console.error('Error updating logos:', error)
|
||||
}
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
updateLogos()
|
||||
Reference in New Issue
Block a user