Files
novatask/doc/sql/novatask.sql

138 lines
7.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `nh_task_progress`
(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL,
`task_id` int(11) unsigned NOT NULL COMMENT '任务id',
`task_seq` int(11) NOT NULL COMMENT '用于可重复任务的序列号',
`stage` tinyint NOT NULL DEFAULT 0 COMMENT '任务的阶段, 0:未完成 1:待校验 2:已完成未领取 3:已领取',
`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 `uid_task_id_seq` (`uid`, `task_id`, `task_seq`)
) COMMENT ='用户任务节点';
CREATE TABLE `nh_nft_holder`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`address` varchar(80) NOT NULL COMMENT '钱包地址',
`token_id` varchar(32) NOT NULL COMMENT 'token id',
`balance` int(11) NOT NULL DEFAULT 0 COMMENT '余额',
`update_seq` int NOT NULL 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 (`token_id`),
INDEX (`update_seq`)
) COMMENT ='nft 持有表';
CREATE TABLE `nh_nft_holder_change_log`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`address` varchar(80) NOT NULL COMMENT '钱包地址',
`token_id` varchar(32) NOT NULL COMMENT 'token id',
`value` int(11) NOT NULL COMMENT '变化数量',
`balance` int(11) NOT NULL 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`)
) COMMENT ='nft 持有表变化日志';
CREATE TABLE `nh_task_nft_stake`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`uid` int unsigned NOT NULL COMMENT '用户钱包',
`role_id` bigint unsigned NOT NULL COMMENT '角色id',
`token_id` varchar(32) NOT NULL COMMENT 'token id',
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型0=小塔罗1=大塔罗',
`state` tinyint NOT NULL DEFAULT 0 COMMENT '状态1质押中 0已取消质押',
`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 (`token_id`)
) COMMENT ='nft质押表';
CREATE TABLE `nh_task_nft_stake_log`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户钱包',
`role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色id',
`token_id` varchar(32) NOT NULL COMMENT 'token id',
`operate` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态1质押 2取消质押, 3转出',
`callback_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '下发通知状态:0未通知,1已通知,2通知异常',
`callback_num` int(10) NOT NULL DEFAULT '0' COMMENT '发送通知次数',
`callback_at` timestamp NULL DEFAULT NULL COMMENT '发送通知最新时间',
`callback_remark` varchar(255) NOT NULL DEFAULT '' 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`),
KEY `callback_status` (`callback_status`) USING BTREE
) COMMENT ='nft质押日志表';
CREATE TABLE `nh_task_nft_stake_reward`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`uid` int unsigned NOT NULL COMMENT '用户钱包',
`award_seq` int NOT NULL COMMENT '派奖序列号',
`pledge_output` decimal(18, 6) NOT NULL DEFAULT 0 COMMENT '质押产出代币',
`random_coefficient` float NOT NULL COMMENT '随机系数',
`occupy_percent` int NOT NULL DEFAULT 0 COMMENT '占领百分比',
`reward` decimal(18, 6) NOT NULL DEFAULT 0 COMMENT '奖励金额',
`sent` bool NOT NULL DEFAULT false 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 (`uid`, `award_seq`)
) COMMENT ='nft质押派奖表';
CREATE TABLE `nh_email_reward`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(80) NOT NULL COMMENT '邮箱',
`uid` int unsigned NOT NULL DEFAULT 0 COMMENT '用户id',
`reward_type` varchar(32) NOT NULL COMMENT '奖励类型:[points,elite_points,castile,keys]',
`value` decimal(18, 6) NOT NULL DEFAULT 0 COMMENT '需要发送的积分',
`remark` varchar(256) NOT NULL DEFAULT '' COMMENT '备注',
`sent_at` int 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`)
) COMMENT ='需要发放积分的';
CREATE TABLE `nh_nft_tarot`
(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`token_id` varchar(32) NOT NULL COMMENT 'token id',
`tarot_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型0=小塔罗1=大塔罗',
`tarot_img` varchar(128) NOT NULL COMMENT '塔罗图片',
PRIMARY KEY (`id`),
UNIQUE KEY (`token_id`)
) COMMENT ='塔罗信息';
CREATE TABLE `nh_stake_points`
(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int unsigned NOT NULL COMMENT '用户id',
`role_id` bigint unsigned NOT NULL COMMENT '角色id',
`level_id` int(11) unsigned NOT NULL COMMENT '档位id',
`level` int unsigned NOT NULL COMMENT '档位',
`points` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '积分数量',
`start_time` timestamp NOT NULL COMMENT '开始时间戳',
`end_time` timestamp NOT NULL COMMENT '结束时间戳',
`status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态1=质押中2=已升级3=已续约4=已过期',
PRIMARY KEY (`id`),
INDEX (`uid`, `role_id`, `level_id`, `status`)
) COMMENT ='积分质押表';
CREATE TABLE `nh_stake_points_log`
(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int unsigned NOT NULL COMMENT '用户id',
`role_id` bigint unsigned NOT NULL COMMENT '角色id',
`level_id` int(11) unsigned NOT NULL COMMENT '档位id',
`level` int unsigned NOT NULL COMMENT '档位',
`points` int(11) NOT NULL DEFAULT 0 COMMENT '积分数量',
`action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '操作类型1=质押2=升级3=续约4=解除',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`),
INDEX (`uid`, `role_id`)
) COMMENT ='积分质押表';