| 12345678910111213141516171819202122232425 |
- -- 表 kku_item_chest_contents 的创建SQL
- DROP TABLE IF EXISTS `kku_item_chest_contents`;
- CREATE TABLE `kku_item_chest_contents` (
- `id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
- `chest_id` int NOT NULL COMMENT '宝箱物品ID,外键关联kku_item_items表',
- `item_id` int DEFAULT NULL COMMENT '可能获得的物品ID,外键关联kku_item_items表(与group_id二选一)',
- `group_id` int DEFAULT NULL COMMENT '物品组ID,外键关联kku_item_groups表(与item_id二选一)',
- `min_quantity` int DEFAULT '1' COMMENT '最小数量',
- `max_quantity` int DEFAULT '1' COMMENT '最大数量',
- `weight` decimal(5,3) NOT NULL COMMENT '权重,决定获取概率',
- `allow_duplicate` tinyint DEFAULT '0' COMMENT '是否允许在同一宝箱中重复掉落(0:不允许, 1:允许)',
- `pity_count` int DEFAULT '0' COMMENT '保底次数,当玩家连续未获得该内容达到次数后必定获得(0表示不启用保底)',
- `pity_weight_factor` float DEFAULT '1' COMMENT '保底权重因子,用于递增概率计算(默认1.0)',
- `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
- PRIMARY KEY (`id`),
- KEY `idx_chest_id` (`chest_id`),
- KEY `idx_item_id` (`item_id`),
- KEY `idx_group_id` (`group_id`),
- KEY `idx_pity_count` (`pity_count`),
- CONSTRAINT `fk_chest_content_chest` FOREIGN KEY (`chest_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE,
- CONSTRAINT `fk_chest_content_group` FOREIGN KEY (`group_id`) REFERENCES `kku_item_groups` (`id`) ON DELETE CASCADE,
- CONSTRAINT `fk_chest_content_item` FOREIGN KEY (`item_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='宝箱内容配置表';
|