| 12345678910111213141516171819 |
- -- 表 kku_item_output_limits 的创建SQL
- DROP TABLE IF EXISTS `kku_item_output_limits`;
- CREATE TABLE `kku_item_output_limits` (
- `id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
- `item_id` int NOT NULL COMMENT '物品ID,外键关联kku_item_items表',
- `limit_type` tinyint NOT NULL COMMENT '限制类型(1:全局总量, 2:单个用户, 3:单日全局, 4:单日用户)',
- `max_quantity` int NOT NULL COMMENT '最大产出数量',
- `current_quantity` int DEFAULT '0' COMMENT '当前已产出数量(全局限制时使用)',
- `reset_type` tinyint DEFAULT '0' COMMENT '重置类型(0:不重置, 1:每日, 2:每周, 3:每月)',
- `last_reset_time` timestamp NULL DEFAULT NULL COMMENT '上次重置时间',
- `related_items` json DEFAULT NULL COMMENT '关联物品ID列表,这些物品共享同一个限制额度',
- `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
- PRIMARY KEY (`id`),
- KEY `idx_item_id` (`item_id`),
- KEY `idx_limit_reset` (`limit_type`,`reset_type`),
- CONSTRAINT `fk_limit_item` FOREIGN KEY (`item_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='物品产出限制表';
|