baoxiang/baoxiang.sql
2025-12-16 18:06:50 +08:00

357 lines
31 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.

/*
Navicat Premium Dump SQL
Source Server : 本地
Source Server Type : MySQL
Source Server Version : 80406 (8.4.6)
Source Host : localhost:3306
Source Schema : baoxiang
Target Server Type : MySQL
Target Server Version : 80406 (8.4.6)
File Encoding : 65001
Date: 15/12/2025 17:44:49
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for announcements
-- ----------------------------
DROP TABLE IF EXISTS `announcements`;
CREATE TABLE `announcements` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告标题',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告内容',
`type` enum('INFO','WARNING','PRIZE') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '公告类型',
`is_pinned` tinyint(1) NULL DEFAULT NULL COMMENT '是否置顶',
`priority` int NULL DEFAULT NULL COMMENT '优先级(数字越大优先级越高)',
`starts_at` datetime NULL DEFAULT NULL COMMENT '生效时间',
`expires_at` datetime NULL DEFAULT NULL COMMENT '过期时间',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT (now()) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ix_announcements_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of announcements
-- ----------------------------
INSERT INTO `announcements` VALUES (1, 'c', 'a', 'WARNING', 1, 0, NULL, NULL, '2025-12-13 08:16:37', '2025-12-13 08:16:37');
INSERT INTO `announcements` VALUES (3, 'dfa', 'sfasd', 'WARNING', 1, 0, NULL, NULL, '2025-12-14 03:16:04', '2025-12-14 03:16:04');
-- ----------------------------
-- Table structure for bets
-- ----------------------------
DROP TABLE IF EXISTS `bets`;
CREATE TABLE `bets` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '用户ID',
`chest_id` int NOT NULL COMMENT '宝箱ID',
`option` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '下注选项',
`amount` bigint NOT NULL COMMENT '下注金额(分)',
`payout` bigint NULL DEFAULT NULL COMMENT '获奖金额(分)',
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '状态',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ix_bets_chest_id`(`chest_id` ASC) USING BTREE,
INDEX `ix_bets_id`(`id` ASC) USING BTREE,
INDEX `ix_bets_user_id`(`user_id` ASC) USING BTREE,
CONSTRAINT `bets_ibfk_1` FOREIGN KEY (`chest_id`) REFERENCES `chests` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of bets
-- ----------------------------
INSERT INTO `bets` VALUES (1, 7, 3, 'A', 500, 0, 'PENDING', '2025-12-14 04:35:46');
INSERT INTO `bets` VALUES (2, 9, 3, 'A', 2300, 0, 'PENDING', '2025-12-14 04:39:06');
INSERT INTO `bets` VALUES (3, 9, 3, 'B', 2500, 0, 'PENDING', '2025-12-14 04:44:04');
INSERT INTO `bets` VALUES (4, 9, 4, 'A', 200, 180, 'WON', '2025-12-14 05:15:13');
INSERT INTO `bets` VALUES (5, 9, 6, 'A', 3000, 0, 'LOST', '2025-12-14 05:23:54');
INSERT INTO `bets` VALUES (6, 9, 6, 'B', 1000, 3600, 'WON', '2025-12-14 05:23:58');
INSERT INTO `bets` VALUES (7, 10, 3, 'A', 1100, 0, 'PENDING', '2025-12-14 05:26:08');
INSERT INTO `bets` VALUES (8, 9, 9, 'A', 100, 0, 'PENDING', '2025-12-14 06:43:42');
INSERT INTO `bets` VALUES (9, 9, 10, 'A', 500, 0, 'LOST', '2025-12-14 10:16:39');
INSERT INTO `bets` VALUES (10, 9, 10, 'B', 1000, 1350, 'WON', '2025-12-14 10:17:11');
INSERT INTO `bets` VALUES (11, 9, 11, 'A', 1000, 0, 'PENDING', '2025-12-14 10:19:24');
INSERT INTO `bets` VALUES (12, 9, 12, 'A', 500, 450, 'WON', '2025-12-14 10:39:53');
INSERT INTO `bets` VALUES (13, 9, 13, 'B', 500, 450, 'WON', '2025-12-14 10:56:23');
INSERT INTO `bets` VALUES (14, 9, 14, 'A', 10911, 18700, 'WON', '2025-12-14 11:03:29');
INSERT INTO `bets` VALUES (15, 9, 14, 'B', 9865, 0, 'LOST', '2025-12-14 11:03:38');
INSERT INTO `bets` VALUES (16, 9, 17, 'A', 100, 0, 'PENDING', '2025-12-14 11:23:25');
-- ----------------------------
-- Table structure for chests
-- ----------------------------
DROP TABLE IF EXISTS `chests`;
CREATE TABLE `chests` (
`id` int NOT NULL AUTO_INCREMENT,
`streamer_id` int NOT NULL COMMENT '主播ID',
`title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '宝箱标题',
`option_a` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项A',
`option_b` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '选项B',
`status` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '宝箱状态',
`pool_a` bigint NULL DEFAULT NULL COMMENT 'A边奖池(分)',
`pool_b` bigint NULL DEFAULT NULL COMMENT 'B边奖池(分)',
`total_bets` int NULL DEFAULT NULL COMMENT '总下注次数',
`countdown_seconds` int NULL DEFAULT NULL COMMENT '倒计时(秒)',
`locked_at` datetime NULL DEFAULT NULL COMMENT '封盘时间',
`settled_at` datetime NULL DEFAULT NULL COMMENT '结算时间',
`result` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '结算结果',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ix_chests_streamer_id`(`streamer_id` ASC) USING BTREE,
INDEX `ix_chests_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of chests
-- ----------------------------
INSERT INTO `chests` VALUES (3, 7, 'sdaf', 'asdf', 'adf', 'BETTING', 3900, 2500, 11, 298, NULL, NULL, NULL, '2025-12-14 04:32:51');
INSERT INTO `chests` VALUES (4, 10, 'ad', '1', '2', 'FINISHED', 200, 0, 2, 300, '2025-12-14 13:15:24', '2025-12-14 13:36:59', 'A', '2025-12-14 05:13:40');
INSERT INTO `chests` VALUES (5, 10, '123', '1', '1', 'FINISHED', 0, 0, 0, 300, '2025-12-14 13:22:59', '2025-12-14 13:36:54', 'A', '2025-12-14 05:22:55');
INSERT INTO `chests` VALUES (6, 10, '123', '1', '1', 'FINISHED', 3000, 1000, 5, 300, '2025-12-14 13:24:45', '2025-12-14 13:36:43', 'B', '2025-12-14 05:23:30');
INSERT INTO `chests` VALUES (7, 10, '`12', '1', '2', 'FINISHED', 0, 0, 0, 300, '2025-12-14 14:38:28', '2025-12-14 14:38:32', 'B', '2025-12-14 06:37:37');
INSERT INTO `chests` VALUES (8, 10, '123', '1', '12', 'FINISHED', 0, 0, 0, 60, '2025-12-14 14:42:30', '2025-12-14 14:42:35', 'B', '2025-12-14 06:38:40');
INSERT INTO `chests` VALUES (9, 10, '123', '1', '12', 'FINISHED', 100, 0, 1, 60, '2025-12-14 18:15:45', '2025-12-14 18:15:50', 'B', '2025-12-14 06:42:51');
INSERT INTO `chests` VALUES (10, 10, '123', '1', '12', 'FINISHED', 500, 1000, 2, 60, '2025-12-14 18:17:59', '2025-12-14 18:18:03', 'B', '2025-12-14 10:16:20');
INSERT INTO `chests` VALUES (11, 10, '123', '123', '111', 'FINISHED', 1000, 0, 1, 60, '2025-12-14 18:39:21', '2025-12-14 18:39:25', 'B', '2025-12-14 10:18:11');
INSERT INTO `chests` VALUES (12, 10, '123', '123', '12311', 'FINISHED', 500, 0, 1, 300, '2025-12-14 18:44:05', '2025-12-14 18:44:11', 'A', '2025-12-14 10:39:32');
INSERT INTO `chests` VALUES (13, 10, '123', '1', '12', 'FINISHED', 0, 500, 1, 300, '2025-12-14 19:02:28', '2025-12-14 19:02:32', 'B', '2025-12-14 10:44:38');
INSERT INTO `chests` VALUES (14, 10, '123', '11', '22', 'FINISHED', 10911, 9865, 2, 300, '2025-12-14 19:04:26', '2025-12-14 19:04:31', 'A', '2025-12-14 11:03:12');
INSERT INTO `chests` VALUES (15, 10, '123', '11', '12', 'FINISHED', 0, 0, 0, 300, '2025-12-14 19:14:02', '2025-12-14 19:14:06', 'B', '2025-12-14 11:09:53');
INSERT INTO `chests` VALUES (16, 10, '123', '123', '111', 'FINISHED', 0, 0, 0, 3600, '2025-12-14 19:22:41', '2025-12-14 19:22:44', 'B', '2025-12-14 11:14:21');
INSERT INTO `chests` VALUES (17, 10, '123', '11', '22', 'FINISHED', 100, 0, 1, 300, '2025-12-14 19:31:50', '2025-12-14 19:31:54', 'B', '2025-12-14 11:23:14');
INSERT INTO `chests` VALUES (18, 10, '请问', '11', '22', 'FINISHED', 0, 0, 0, 3000, '2025-12-14 19:56:18', '2025-12-14 19:56:22', 'A', '2025-12-14 11:32:03');
INSERT INTO `chests` VALUES (19, 10, '123', '12', '1211', 'FINISHED', 0, 0, 0, 300, '2025-12-14 19:59:04', '2025-12-14 19:59:08', 'REFUND', '2025-12-14 11:56:27');
INSERT INTO `chests` VALUES (20, 12, '测试宝箱 19:57:28', '选项A', '选项B', 'BETTING', 0, 0, 0, 60, NULL, NULL, NULL, '2025-12-14 11:57:30');
INSERT INTO `chests` VALUES (21, 10, '1123', '11', '22', 'FINISHED', 0, 0, 0, 300, '2025-12-15 12:28:43', '2025-12-15 12:28:54', 'REFUND', '2025-12-15 04:28:25');
-- ----------------------------
-- Table structure for streamer_profiles
-- ----------------------------
DROP TABLE IF EXISTS `streamer_profiles`;
CREATE TABLE `streamer_profiles` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '用户ID',
`display_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主播展示名称',
`avatar_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主播头像',
`bio` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '主播简介',
`commission_rate` decimal(5, 2) NULL DEFAULT NULL COMMENT '主播抽成比例(%)',
`max_active_chests` int NULL DEFAULT NULL COMMENT '最大活跃宝箱数',
`total_chests` int NULL DEFAULT NULL COMMENT '历史宝箱总数',
`total_winnings` decimal(15, 2) NULL DEFAULT NULL COMMENT '历史获奖总额(分)',
`status` enum('ACTIVE','SUSPENDED','BANNED') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主播状态',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT (now()) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_id`(`user_id` ASC) USING BTREE,
INDEX `ix_streamer_profiles_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of streamer_profiles
-- ----------------------------
INSERT INTO `streamer_profiles` VALUES (1, 9, 'test1', NULL, NULL, 5.00, 10, 0, 0.00, 'ACTIVE', '2025-12-14 03:30:38', '2025-12-14 03:30:38');
INSERT INTO `streamer_profiles` VALUES (2, 7, 'zhubo', NULL, NULL, 5.00, 10, 0, 0.00, 'ACTIVE', '2025-12-14 04:32:10', '2025-12-14 04:32:10');
INSERT INTO `streamer_profiles` VALUES (3, 10, 'zhubo12', NULL, NULL, 5.00, 10, 0, 0.00, 'ACTIVE', '2025-12-14 05:13:20', '2025-12-14 05:13:20');
-- ----------------------------
-- Table structure for system_configs
-- ----------------------------
DROP TABLE IF EXISTS `system_configs`;
CREATE TABLE `system_configs` (
`id` int NOT NULL AUTO_INCREMENT,
`config_key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置键',
`config_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置值',
`config_type` enum('STRING','NUMBER','BOOLEAN','JSON') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置类型',
`category` enum('GAME_ECONOMY','GAME_LOGIC','SYSTEM_OPERATIONS','UI_DISPLAY') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置分类',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置描述',
`is_editable` tinyint(1) NULL DEFAULT NULL COMMENT '是否可编辑',
`is_public` tinyint(1) NULL DEFAULT NULL COMMENT '是否对前端公开',
`display_order` int NULL DEFAULT NULL COMMENT '显示顺序',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT (now()) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `ix_system_configs_config_key`(`config_key` ASC) USING BTREE,
INDEX `ix_system_configs_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_configs
-- ----------------------------
INSERT INTO `system_configs` VALUES (1, 'GAME_NEW_USER_REWARD', '1', 'NUMBER', 'GAME_ECONOMY', '新用户注册奖励(分)', 1, 0, 1, '2025-12-14 02:44:50', '2025-12-14 05:32:52');
INSERT INTO `system_configs` VALUES (2, 'GAME_DAILY_ALLOWANCE', '50', 'NUMBER', 'GAME_ECONOMY', '每日低保(分)', 1, 0, 2, '2025-12-14 02:44:50', '2025-12-14 04:12:58');
INSERT INTO `system_configs` VALUES (3, 'GAME_ALLOWANCE_THRESHOLD', '10', 'NUMBER', 'GAME_ECONOMY', '低保门槛(分)', 1, 0, 3, '2025-12-14 02:44:50', '2025-12-14 05:33:00');
INSERT INTO `system_configs` VALUES (4, 'GAME_HOUSE_EDGE', '0.10', 'NUMBER', 'GAME_ECONOMY', '总抽水比例', 1, 0, 4, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (5, 'GAME_STREAMER_SHARE', '0.05', 'NUMBER', 'GAME_ECONOMY', '主播分润比例', 1, 0, 5, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (6, 'GAME_PLATFORM_SHARE', '0.05', 'NUMBER', 'GAME_ECONOMY', '平台分润比例', 1, 0, 6, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (7, 'GAME_DAILY_CHECKIN_REWARD', '10', 'NUMBER', 'GAME_ECONOMY', '每日签到奖励(分)', 1, 0, 7, '2025-12-14 02:44:50', '2025-12-14 05:33:07');
INSERT INTO `system_configs` VALUES (8, 'GAME_DEFAULT_COUNTDOWN', '300', 'NUMBER', 'GAME_LOGIC', '默认倒计时(秒)', 1, 0, 1, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (9, 'GAME_MIN_COUNTDOWN', '10', 'NUMBER', 'GAME_LOGIC', '最小倒计时(秒)', 1, 0, 2, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (10, 'GAME_MAX_COUNTDOWN', '3600', 'NUMBER', 'GAME_LOGIC', '最大倒计时(秒)', 1, 0, 3, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (11, 'GAME_DEFAULT_MAX_ACTIVE_CHESTS', '10', 'NUMBER', 'GAME_LOGIC', '默认最大活跃宝箱数', 1, 0, 4, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (12, 'GAME_MIN_COMMISSION_RATE', '0.0', 'NUMBER', 'GAME_LOGIC', '最小主播抽成(%)', 1, 0, 5, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (13, 'GAME_MAX_COMMISSION_RATE', '100.0', 'NUMBER', 'GAME_LOGIC', '最大主播抽成(%)', 1, 0, 6, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (14, 'GAME_DEFAULT_COMMISSION_RATE', '5.0', 'NUMBER', 'GAME_LOGIC', '默认主播抽成(%)', 1, 0, 7, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (15, 'PAGINATION_DEFAULT_PAGE_SIZE', '10', 'NUMBER', 'SYSTEM_OPERATIONS', '默认分页大小', 1, 0, 1, '2025-12-14 02:44:50', '2025-12-14 05:33:24');
INSERT INTO `system_configs` VALUES (16, 'PAGINATION_ADMIN_PAGE_SIZE', '10', 'NUMBER', 'SYSTEM_OPERATIONS', '管理员页面分页大小', 1, 0, 2, '2025-12-14 02:44:50', '2025-12-14 05:33:28');
INSERT INTO `system_configs` VALUES (17, 'PAGINATION_ANNOUNCEMENT_PAGE_SIZE', '10', 'NUMBER', 'SYSTEM_OPERATIONS', '公告页面分页大小', 1, 0, 3, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (18, 'WS_BROADCAST_INTERVAL', '200', 'NUMBER', 'SYSTEM_OPERATIONS', 'WebSocket广播间隔(毫秒)', 1, 0, 4, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (19, 'WS_HEARTBEAT_INTERVAL', '30', 'NUMBER', 'SYSTEM_OPERATIONS', 'WebSocket心跳间隔(秒)', 1, 0, 5, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (20, 'WS_CONNECTION_TIMEOUT', '60', 'NUMBER', 'SYSTEM_OPERATIONS', 'WebSocket连接超时(秒)', 1, 0, 6, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (21, 'ANNOUNCEMENT_DEFAULT_PRIORITY', '0', 'NUMBER', 'UI_DISPLAY', '公告默认优先级', 1, 0, 1, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
INSERT INTO `system_configs` VALUES (22, 'ANNOUNCEMENT_MAX_PRIORITY', '100', 'NUMBER', 'UI_DISPLAY', '公告最大优先级', 1, 0, 2, '2025-12-14 02:44:50', '2025-12-14 02:44:50');
-- ----------------------------
-- Table structure for transactions
-- ----------------------------
DROP TABLE IF EXISTS `transactions`;
CREATE TABLE `transactions` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '用户ID',
`type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易类型',
`amount` bigint NOT NULL COMMENT '金额(分)',
`balance_after` bigint NOT NULL COMMENT '交易后余额',
`related_id` int NULL DEFAULT NULL COMMENT '关联ID',
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ix_transactions_id`(`id` ASC) USING BTREE,
INDEX `ix_transactions_user_id`(`user_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of transactions
-- ----------------------------
INSERT INTO `transactions` VALUES (1, 5, '低保', 5000, 5000, NULL, '每日低保', '2025-12-13 07:14:26');
INSERT INTO `transactions` VALUES (2, 6, '注册奖励', 100000, 0, NULL, '新用户注册奖励', '2025-12-13 07:39:19');
INSERT INTO `transactions` VALUES (3, 6, '低保', 5000, 5000, NULL, '每日低保', '2025-12-13 07:39:23');
INSERT INTO `transactions` VALUES (4, 7, '注册奖励', 100000, 0, NULL, '新用户注册奖励', '2025-12-13 07:46:22');
INSERT INTO `transactions` VALUES (5, 7, '低保', 5000, 5000, NULL, '每日低保', '2025-12-13 07:46:38');
INSERT INTO `transactions` VALUES (6, 8, '注册奖励', 100000, 0, NULL, '新用户注册奖励', '2025-12-13 09:03:37');
INSERT INTO `transactions` VALUES (7, 8, '低保', 5000, 5000, NULL, '每日低保', '2025-12-13 09:07:49');
INSERT INTO `transactions` VALUES (8, 9, '注册奖励', 100000, 0, NULL, '新用户注册奖励', '2025-12-13 09:22:26');
INSERT INTO `transactions` VALUES (9, 9, '低保', 5000, 5000, NULL, '每日低保', '2025-12-13 09:28:01');
INSERT INTO `transactions` VALUES (10, 5, '管理员调整', -22211, -17211, NULL, '管理员调整 (操作人: admin)', '2025-12-14 02:42:50');
INSERT INTO `transactions` VALUES (11, 9, '管理员调整', 22, 5022, NULL, '管理员调整 (操作人: admin)', '2025-12-14 03:24:27');
INSERT INTO `transactions` VALUES (12, 7, '下注', -500, 4500, 3, '下注sdaf(A边)', '2025-12-14 04:35:46');
INSERT INTO `transactions` VALUES (13, 9, '下注', -1000, 4022, 3, '下注sdaf(A边)', '2025-12-14 04:39:06');
INSERT INTO `transactions` VALUES (14, 9, '下注', -1000, 3022, 3, '下注sdaf(B边)', '2025-12-14 04:44:04');
INSERT INTO `transactions` VALUES (15, 9, '下注', -1000, 2022, 3, '追加下注sdaf(B边)', '2025-12-14 04:44:10');
INSERT INTO `transactions` VALUES (16, 9, '下注', -500, 1522, 3, '追加下注sdaf(B边)', '2025-12-14 04:44:18');
INSERT INTO `transactions` VALUES (17, 9, '下注', -1000, 522, 3, '追加下注sdaf(A边)', '2025-12-14 04:46:23');
INSERT INTO `transactions` VALUES (18, 9, '下注', -100, 422, 3, '追加下注sdaf(A边)', '2025-12-14 04:46:28');
INSERT INTO `transactions` VALUES (19, 10, '注册奖励', 100000, 0, NULL, '新用户注册奖励', '2025-12-14 05:12:53');
INSERT INTO `transactions` VALUES (20, 9, '下注', -100, 322, 4, '下注ad(A边)', '2025-12-14 05:15:13');
INSERT INTO `transactions` VALUES (21, 9, '下注', -100, 222, 4, '追加下注ad(A边)', '2025-12-14 05:15:19');
INSERT INTO `transactions` VALUES (22, 5, '低保', 5000, -12211, NULL, '每日低保', '2025-12-14 05:17:33');
INSERT INTO `transactions` VALUES (23, 9, '管理员调整', 111111, 111333, NULL, '管理员调整 (操作人: admin)', '2025-12-14 05:18:01');
INSERT INTO `transactions` VALUES (24, 5, '管理员调整', 111111, 98900, NULL, '省分公司个 (操作人: admin)', '2025-12-14 05:18:06');
INSERT INTO `transactions` VALUES (25, 5, '管理员调整', 111, 99011, NULL, '管理员调整 (操作人: admin)', '2025-12-14 05:18:25');
INSERT INTO `transactions` VALUES (26, 5, '管理员调整', 3452342, 3551353, NULL, '管理员调整 (操作人: admin)', '2025-12-14 05:18:48');
INSERT INTO `transactions` VALUES (27, 9, '下注', -500, 110833, 6, '下注123(A边)', '2025-12-14 05:23:54');
INSERT INTO `transactions` VALUES (28, 9, '下注', -1000, 109833, 6, '下注123(B边)', '2025-12-14 05:23:58');
INSERT INTO `transactions` VALUES (29, 9, '下注', -500, 109333, 6, '追加下注123(A边)', '2025-12-14 05:24:04');
INSERT INTO `transactions` VALUES (30, 9, '下注', -1000, 108333, 6, '追加下注123(A边)', '2025-12-14 05:24:13');
INSERT INTO `transactions` VALUES (31, 9, '下注', -1000, 107333, 6, '追加下注123(A边)', '2025-12-14 05:24:27');
INSERT INTO `transactions` VALUES (32, 10, '低保', 5000, 5000, NULL, '每日低保', '2025-12-14 05:25:12');
INSERT INTO `transactions` VALUES (33, 10, '下注', -100, 4900, 3, '下注sdaf(A边)', '2025-12-14 05:26:08');
INSERT INTO `transactions` VALUES (34, 10, '抽水分润', 200, 5100, 6, '宝箱《123》抽水分润', '2025-12-14 05:36:42');
INSERT INTO `transactions` VALUES (35, 9, '获胜', 3600, 110933, 6, '宝箱《123》获胜奖金', '2025-12-14 05:36:42');
INSERT INTO `transactions` VALUES (36, 10, '抽水分润', 10, 5110, 4, '宝箱《ad》抽水分润', '2025-12-14 05:36:59');
INSERT INTO `transactions` VALUES (37, 9, '获胜', 180, 111113, 4, '宝箱《ad》获胜奖金', '2025-12-14 05:36:59');
INSERT INTO `transactions` VALUES (38, 7, '管理员调整', 111, 4611, NULL, '管理员调整 (操作人: admin)', '2025-12-14 05:59:43');
INSERT INTO `transactions` VALUES (39, 5, '管理员调整', -10000, 3541353, NULL, '管理员调整 (操作人: admin)', '2025-12-14 05:59:53');
INSERT INTO `transactions` VALUES (40, 5, '管理员调整', -3540000, 1353, NULL, '管理员调整 (操作人: admin)', '2025-12-14 06:00:13');
INSERT INTO `transactions` VALUES (41, 9, '下注', -100, 111013, 3, '追加下注sdaf(A边)', '2025-12-14 06:11:27');
INSERT INTO `transactions` VALUES (42, 9, '下注', -100, 110913, 3, '追加下注sdaf(A边)', '2025-12-14 06:11:33');
INSERT INTO `transactions` VALUES (43, 5, '管理员调整', 1111, 2464, NULL, '管理员调整 (操作人: admin)', '2025-12-14 06:12:33');
INSERT INTO `transactions` VALUES (44, 9, '下注', -100, 110813, 9, '下注123(A边)', '2025-12-14 06:43:42');
INSERT INTO `transactions` VALUES (45, 10, '抽水分润', 5, 5115, 9, '宝箱《123》抽水分润', '2025-12-14 10:15:49');
INSERT INTO `transactions` VALUES (46, 10, '下注', -1000, 4115, 3, '追加下注sdaf(A边)', '2025-12-14 10:16:07');
INSERT INTO `transactions` VALUES (47, 9, '下注', -500, 110313, 10, '下注123(A边)', '2025-12-14 10:16:39');
INSERT INTO `transactions` VALUES (48, 9, '下注', -1000, 109313, 10, '下注123(B边)', '2025-12-14 10:17:11');
INSERT INTO `transactions` VALUES (49, 10, '抽水分润', 75, 4190, 10, '宝箱《123》抽水分润', '2025-12-14 10:18:02');
INSERT INTO `transactions` VALUES (50, 9, '获胜', 1350, 110663, 10, '宝箱《123》获胜奖金', '2025-12-14 10:18:02');
INSERT INTO `transactions` VALUES (51, 9, '下注', -1000, 109663, 11, '下注123(A边)', '2025-12-14 10:19:24');
INSERT INTO `transactions` VALUES (52, 10, '抽水分润', 50, 4240, 11, '宝箱《123》抽水分润', '2025-12-14 10:39:25');
INSERT INTO `transactions` VALUES (53, 9, '下注', -500, 109163, 12, '下注123(A边)', '2025-12-14 10:39:53');
INSERT INTO `transactions` VALUES (54, 10, '抽水分润', 25, 4265, 12, '宝箱《123》抽水分润', '2025-12-14 10:44:08');
INSERT INTO `transactions` VALUES (55, 9, '下注', -500, 109113, 13, '下注123(B边)', '2025-12-14 10:56:23');
INSERT INTO `transactions` VALUES (56, 10, '抽水分润', 25, 4290, 13, '宝箱《123》抽水分润', '2025-12-14 11:02:31');
INSERT INTO `transactions` VALUES (57, 9, '获胜', 450, 109563, 13, '宝箱《123》获胜奖金', '2025-12-14 11:02:31');
INSERT INTO `transactions` VALUES (58, 9, '下注', -10911, 98652, 14, '下注123(A边)', '2025-12-14 11:03:29');
INSERT INTO `transactions` VALUES (59, 9, '下注', -9865, 88787, 14, '下注123(B边)', '2025-12-14 11:03:38');
INSERT INTO `transactions` VALUES (60, 10, '抽水分润', 1038, 5328, 14, '宝箱《123》抽水分润', '2025-12-14 11:04:30');
INSERT INTO `transactions` VALUES (61, 9, '获胜', 18700, 107487, 14, '宝箱《123》获胜奖金', '2025-12-14 11:04:30');
INSERT INTO `transactions` VALUES (62, 9, '下注', -100, 107387, 17, '下注123(A边)', '2025-12-14 11:23:26');
INSERT INTO `transactions` VALUES (63, 10, '抽水分润', 5, 5333, 17, '宝箱《123》抽水分润', '2025-12-14 11:31:54');
-- ----------------------------
-- Table structure for user_operation_logs
-- ----------------------------
DROP TABLE IF EXISTS `user_operation_logs`;
CREATE TABLE `user_operation_logs` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '操作用户ID',
`operator_id` int NULL DEFAULT NULL COMMENT '操作人ID管理员',
`operation_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作类型',
`operation_details` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '操作详情(JSON格式)',
`ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'IP地址',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ix_user_operation_logs_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user_operation_logs
-- ----------------------------
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱',
`hashed_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '哈希密码',
`role` enum('USER','STREAMER','ADMIN') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户角色',
`nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户昵称',
`avatar_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像URL',
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号',
`status` enum('ACTIVE','DISABLED','BANNED') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户状态',
`balance` bigint NULL DEFAULT NULL COMMENT '余额(分)',
`version` int NULL DEFAULT NULL COMMENT '乐观锁版本号',
`last_login_at` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
`login_count` int NULL DEFAULT NULL COMMENT '登录次数',
`created_at` datetime NULL DEFAULT (now()) COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT (now()) COMMENT '更新时间',
`is_active` tinyint NULL DEFAULT NULL COMMENT '是否激活(1:是 0:否)',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `ix_users_email`(`email` ASC) USING BTREE,
UNIQUE INDEX `ix_users_username`(`username` ASC) USING BTREE,
INDEX `ix_users_id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, 'testuser', 'test@example.com', '$scrypt$ln=16,r=8,p=1$sdYa4zzHuHduLQWAsLZWSg$jUu5IbiK+htBbLOt/qBP6WR5zQRMMPwbhVDx6aP/dKw', 'USER', NULL, NULL, NULL, 'ACTIVE', 0, 0, NULL, 0, '2025-12-13 03:07:55', '2025-12-14 02:03:21', 1);
INSERT INTO `users` VALUES (2, 'testuser123', 'test123@example.com', '$scrypt$ln=16,r=8,p=1$Zux9b21NiTFGqNXamzOG0A$4gQGVyGfobpB87bjk44+dwhX5b/tj7x8YTxGT83aFHg', 'USER', NULL, NULL, NULL, 'ACTIVE', 0, 0, NULL, 0, '2025-12-13 03:07:55', '2025-12-13 03:07:55', 1);
INSERT INTO `users` VALUES (3, 'test', 'test@test.com', '$scrypt$ln=16,r=8,p=1$VMoZ41zL2ZsTYoxx7v0/Bw$yQOZIticgjRM7s4MTVXV44wgYgehsrxAoki27ot2fAc', 'USER', NULL, NULL, NULL, 'ACTIVE', 0, 0, NULL, 0, '2025-12-13 03:07:55', '2025-12-13 03:07:55', 1);
INSERT INTO `users` VALUES (5, 'admin', 'amdin@ad.c', '$scrypt$ln=16,r=8,p=1$AaDU+l9rjTGGsLYWIsS4tw$EyZmBBLjJifJSiBWexovADnvvR2hRq8NMSZIBePBzfs', 'ADMIN', NULL, NULL, NULL, 'ACTIVE', 2464, 7, NULL, 0, '2025-12-13 03:10:35', '2025-12-14 06:12:33', 1);
INSERT INTO `users` VALUES (6, 'user1', 'user@qq.com', '$scrypt$ln=16,r=8,p=1$xzhHiHGu1dq7lzIGQAiBMA$/IMDnslsTmQSNclXcX1z6z8/6RX9mUdgDIJU9PZaOV4', 'USER', NULL, NULL, NULL, 'ACTIVE', 5000, 0, NULL, 0, '2025-12-13 07:39:19', '2025-12-13 07:39:23', 1);
INSERT INTO `users` VALUES (7, 'zhubo', 'zhobo@zhuobo.com', '$scrypt$ln=16,r=8,p=1$dk5pzbnXOgfAmJOylrK21g$QhgDI2BJdlRDSkAIc6TMsuU10IP97arhwraxw0MKZWk', 'STREAMER', NULL, NULL, NULL, 'ACTIVE', 4611, 2, NULL, 0, '2025-12-13 07:46:22', '2025-12-14 05:59:43', 1);
INSERT INTO `users` VALUES (8, 'zhubo1', 'zhuobo12@q.q', '$scrypt$ln=16,r=8,p=1$uxeCcK5VqrV2DuEcQwiBsA$OwN51jBQIbyGhCnJfWTeWcOQy3FIa3qnljkCuokWMjo', 'USER', NULL, NULL, NULL, 'ACTIVE', 5000, 0, NULL, 0, '2025-12-13 09:03:37', '2025-12-14 02:03:48', 1);
INSERT INTO `users` VALUES (9, 'test1', 'te11st@test.com', '$scrypt$ln=16,r=8,p=1$RYgRIiRkTIlxLmWMkfKekw$e0bQSZ8aoelJq0X3A+x8xRXHVDiDGZ8Y+evhnNs48mM', 'USER', NULL, NULL, NULL, 'ACTIVE', 107387, 26, NULL, 0, '2025-12-13 09:22:26', '2025-12-14 11:23:25', 1);
INSERT INTO `users` VALUES (10, 'zhubo12', 'zhu@q.oc', '$scrypt$ln=16,r=8,p=1$x3hPyflfKwXAOAfA2Fvr/Q$mstdmf0PWLrdrbrWGYDXZHdO79CdTmJqPg7/Dt38vLg', 'STREAMER', NULL, NULL, NULL, 'ACTIVE', 5333, 2, NULL, 0, '2025-12-14 05:12:53', '2025-12-14 11:31:54', 1);
INSERT INTO `users` VALUES (11, 'streamer1', 'streamer1@example.com', '$scrypt$ln=16,r=8,p=1$KkVo7T0nZAyhNIYQIqR0Lg$iqN2qdCYPzgfhLiLDhgCAuTKzF0Nr1+1alm3/zVL0IU', 'STREAMER', NULL, NULL, NULL, 'ACTIVE', 0, 0, NULL, 0, '2025-12-14 11:27:41', '2025-12-14 11:27:41', 1);
INSERT INTO `users` VALUES (12, 'streamer', 'streamer@example.com', '$scrypt$ln=16,r=8,p=1$BWAsRYixVqqV8t7b27v3ng$8O+rQCKRJtTE56I2oYyRR8Zjl6tu/JPa4XgiFDdKayY', 'STREAMER', '测试主播', NULL, NULL, 'ACTIVE', 500000, 0, NULL, 0, '2025-12-14 11:57:11', '2025-12-14 11:57:11', 1);
INSERT INTO `users` VALUES (13, 'user', 'user@example.com', '$scrypt$ln=16,r=8,p=1$UGpNqZWy1ppzjjEmROi9tw$d9aGNBDqO0fyGnSttv1NpMs7Ra0uovlAsT/cF5FDxlU', 'USER', '测试用户', NULL, NULL, 'ACTIVE', 200000, 0, NULL, 0, '2025-12-14 11:57:11', '2025-12-14 11:57:11', 1);
SET FOREIGN_KEY_CHECKS = 1;