fix: 同步后刷新考勤视图 + 全局错误捕获层(白屏转错误报告)
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user