fix: 同步后刷新考勤视图 + 全局错误捕获层(白屏转错误报告)

This commit is contained in:
root
2026-10-16 14:10:21 +08:00
parent 8c9f2f0c8b
commit 8a0fde507f
7 changed files with 58 additions and 16 deletions
+3 -1
View File
@@ -5,6 +5,7 @@ import { db } from '../db/schema'
import { getSetting, setSetting } from '../db/repo'
import { getCloudCreds } from '../db/auth'
import { nowLocalISO } from '../lib/date'
import { notifyAttendanceChanged } from '../lib/bus'
export const DEFAULT_SYNC_BASE = 'https://daywk.linyux.cn'
@@ -344,11 +345,12 @@ async function doRunSync(config: SyncConfig): Promise<SyncResult> {
}
}
// 4. 重建镜像 + 建立 SSE 实时通道
// 4. 重建镜像 + 建立 SSE 实时通道 + 广播考勤变更
await db.sync_mirror.clear()
if (finalMirror.length) await db.sync_mirror.bulkAdd(finalMirror.map(m => ({ ...m })))
ensureSSE(base, token)
const at = nowLocalISO()
await setSetting('sync_last_time', at)
if (pulled > 0 || removed > 0) notifyAttendanceChanged()
return { pushed, pulled, removed, at }
}