refactor: harden task authority and room mutations

This commit is contained in:
ANG-Server
2026-07-23 00:59:00 +08:00
parent 3f14230e15
commit 968a672fbd
24 changed files with 748 additions and 64 deletions

View File

@@ -21,9 +21,19 @@ CREATE TABLE IF NOT EXISTS `room_decor_placements` (
`scale` FLOAT NOT NULL DEFAULT 1 COMMENT '摆件缩放',
`rotation_degrees` FLOAT NOT NULL DEFAULT 0 COMMENT '摆件旋转角度',
`z_index` INT NOT NULL DEFAULT 0 COMMENT '摆放层级',
`mutation_revision` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后修改该摆件的布局版本',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_room_decor_placements_user_decor_unique` (`user_id`, `decor_id`),
KEY `idx_room_decor_placements_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `room_decor_layout_state` (
`user_id` BIGINT NOT NULL COMMENT '关联users.id',
`revision` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '当前布局版本',
`last_mutation_id` VARCHAR(64) NULL COMMENT '最后一次幂等mutation ID',
`last_mutation_scope` VARCHAR(120) NULL COMMENT '最后一次mutation作用域',
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;