增加续杯激活

This commit is contained in:
2026-06-15 23:43:49 +08:00
parent 6b8651af25
commit 6788d49f47
5 changed files with 821 additions and 0 deletions
@@ -0,0 +1,31 @@
-- Cursor 激活码管理
-- status: 0 未使用 1 已使用 2 已过期 3 已禁用
-- type: 0 自定义 1 天卡 7 周卡 30 月卡 90 季卡 365 年卡
CREATE TABLE IF NOT EXISTS `yz_platform_cursor_activation_code` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`code` varchar(128) NOT NULL COMMENT '激活码',
`type` int NOT NULL DEFAULT 30 COMMENT '卡密类型:0自定义 1天卡 7周卡 30月卡 90季卡 365年卡',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态:0未使用 1已使用 2已过期 3已禁用',
`duration_days` int NOT NULL DEFAULT 30 COMMENT '有效天数',
`bind_account` varchar(128) DEFAULT NULL COMMENT '绑定账号',
`bind_device_id` bigint unsigned DEFAULT NULL COMMENT '绑定设备ID,关联 yz_platform_cursor_equipment.id',
`machine_code` varchar(128) DEFAULT NULL COMMENT '绑定设备机器码',
`device_info` varchar(1000) DEFAULT NULL COMMENT '绑定设备信息',
`owner_user_id` bigint unsigned DEFAULT NULL COMMENT '归属用户ID',
`owner_user_name` varchar(128) DEFAULT NULL COMMENT '归属用户名称',
`activated_at` datetime DEFAULT NULL COMMENT '激活时间',
`expired_at` datetime DEFAULT NULL COMMENT '过期时间',
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`delete_time` datetime DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`),
KEY `idx_status_delete` (`status`,`delete_time`),
KEY `idx_type_status` (`type`,`status`),
KEY `idx_bind_account` (`bind_account`),
KEY `idx_bind_device_id` (`bind_device_id`),
KEY `idx_owner_user_id` (`owner_user_id`),
KEY `idx_expired_at` (`expired_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Cursor续杯激活码';