feat: 多端同步服务端与引擎 + Capacitor 安卓工程(v1.13)

This commit is contained in:
root
2026-10-16 11:07:37 +08:00
parent ee795eeefb
commit de3add8881
70 changed files with 2039 additions and 12 deletions
+23 -1
View File
@@ -78,6 +78,22 @@ export interface Transaction {
created_at: string
}
// 同步镜像:记录上次同步时每条数据的哈希,用于增量差异检测
export interface SyncMirror {
id?: number
table: string
uuid: string
hash: string
}
// 删除墓碑:同步时告知其他端该记录已删除
export interface SyncTombstone {
id?: number
table: string
uuid: string
deleted_at: string
}
export class WorklogDB extends Dexie {
project!: Table<Project, number>
work_log!: Table<WorkLog, number>
@@ -88,6 +104,8 @@ export class WorklogDB extends Dexie {
memo!: Table<Memo, number>
credential!: Table<Credential, number>
transaction!: Table<Transaction, number>
sync_mirror!: Table<SyncMirror, number>
tombstone!: Table<SyncTombstone, number>
constructor(dbName = 'intern_worklog') {
super(dbName)
@@ -106,6 +124,10 @@ export class WorklogDB extends Dexie {
this.version(3).stores({
transaction: '++id, date, type, category'
})
this.version(4).stores({
sync_mirror: '++id, table, uuid',
tombstone: '++id, table, uuid, deleted_at'
})
}
}
@@ -121,7 +143,7 @@ export function unbindDatabase(): void {
db = undefined
}
export const SCHEMA_VERSION = 3
export const SCHEMA_VERSION = 4
export const EXPENSE_CATEGORIES: string[] = ['餐饮', '交通', '住房', '通讯', '学习', '娱乐', '其他']
export const INCOME_CATEGORIES: string[] = ['工资', '报销', '其他']