text: SET NAMES utf8mb4;
  SET FOREIGN_KEY_CHECKS = 0;
  
  -- ----------------------------
  -- Table structure for alive_ip
  -- ----------------------------
  DROP TABLE IF EXISTS `alive_ip`;
  CREATE TABLE `alive_ip`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `nodeid` int(11) NOT NULL,
    `userid` int(11) NOT NULL,
    `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for announcement
  -- ----------------------------
  DROP TABLE IF EXISTS `announcement`;
  CREATE TABLE `announcement`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `date` datetime(0) NOT NULL,
    `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `markdown` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for auto
  -- ----------------------------
  DROP TABLE IF EXISTS `auto`;
  CREATE TABLE `auto`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `type` int(11) NOT NULL,
    `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `sign` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for blockip
  -- ----------------------------
  DROP TABLE IF EXISTS `blockip`;
  CREATE TABLE `blockip`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `nodeid` int(11) NOT NULL,
    `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for bought
  -- ----------------------------
  DROP TABLE IF EXISTS `bought`;
  CREATE TABLE `bought`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userid` int(11) NOT NULL,
    `shopid` int(11) NOT NULL,
    `datetime` int(11) NOT NULL,
    `renew` int(11) NOT NULL,
    `coupon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `price` decimal(12, 2) NOT NULL,
    `usedd` int(2) NOT NULL DEFAULT 0 COMMENT '生效套餐',
    `is_notified` tinyint(1) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for code
  -- ----------------------------
  DROP TABLE IF EXISTS `code`;
  CREATE TABLE `code`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `type` int(11) NOT NULL,
    `number` decimal(11, 2) NOT NULL,
    `isused` int(11) NOT NULL DEFAULT 0,
    `userid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `usedatetime` datetime(0) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for config
  -- ----------------------------
  DROP TABLE IF EXISTS `config`;
  CREATE TABLE `config`  (
    `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    PRIMARY KEY (`name`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for coupon
  -- ----------------------------
  DROP TABLE IF EXISTS `coupon`;
  CREATE TABLE `coupon`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `onetime` int(11) NOT NULL,
    `expire` int(11) NOT NULL,
    `shop` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `credit` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for detect_ban_log
  -- ----------------------------
  DROP TABLE IF EXISTS `detect_ban_log`;
  CREATE TABLE `detect_ban_log`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',
    `user_id` int(11) NOT NULL COMMENT '用户 ID',
    `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户邮箱',
    `detect_number` int(11) NOT NULL COMMENT '本次违规次数',
    `ban_time` int(11) NOT NULL COMMENT '本次封禁时长',
    `start_time` int(11) NOT NULL COMMENT '统计开始时间',
    `end_time` int(11) NOT NULL COMMENT '统计结束时间',
    `all_detect_number` int(11) NOT NULL COMMENT '累计违规次数',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '审计封禁日志' ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for detect_list
  -- ----------------------------
  DROP TABLE IF EXISTS `detect_list`;
  CREATE TABLE `detect_list`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `regex` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `type` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for detect_log
  -- ----------------------------
  DROP TABLE IF EXISTS `detect_log`;
  CREATE TABLE `detect_log`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `list_id` int(11) NOT NULL,
    `datetime` int(11) NOT NULL,
    `node_id` int(11) NOT NULL,
    `status` int(2) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for disconnect_ip
  -- ----------------------------
  DROP TABLE IF EXISTS `disconnect_ip`;
  CREATE TABLE `disconnect_ip`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userid` int(11) NOT NULL,
    `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for email_queue
  -- ----------------------------
  DROP TABLE IF EXISTS `email_queue`;
  CREATE TABLE `email_queue`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `to_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `subject` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `template` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `array` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'Email Queue 發件列表' ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for email_verify
  -- ----------------------------
  DROP TABLE IF EXISTS `email_verify`;
  CREATE TABLE `email_verify`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `expire_in` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for gconfig
  -- ----------------------------
  DROP TABLE IF EXISTS `gconfig`;
  CREATE TABLE `gconfig`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置键名',
    `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值类型',
    `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置值',
    `oldvalue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '之前的配置值',
    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置名称',
    `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置描述',
    `operator_id` int(11) NOT NULL COMMENT '操作员 ID',
    `operator_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作员名称',
    `operator_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作员邮箱',
    `last_update` int(11) NOT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网站配置' ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for help
  -- ----------------------------
  DROP TABLE IF EXISTS `help`;
  CREATE TABLE `help`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
    `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `markdown` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `class` int(11) NOT NULL,
    `add_time` datetime(0) NOT NULL,
    `ontop` int(11) NULL DEFAULT 0,
    `sort` int(11) NULL DEFAULT 0,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for help_class
  -- ----------------------------
  DROP TABLE IF EXISTS `help_class`;
  CREATE TABLE `help_class`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分类名称',
    `upid` int(11) NULL DEFAULT NULL COMMENT '上级分类ID',
    `li` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字体图标',
    `pageshow` int(11) NULL DEFAULT NULL COMMENT '是否在页面显示',
    `sort` int(11) NULL DEFAULT NULL COMMENT '排序',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for link
  -- ----------------------------
  DROP TABLE IF EXISTS `link`;
  CREATE TABLE `link`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `type` int(11) NOT NULL,
    `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `port` int(11) NOT NULL,
    `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `ios` int(11) NOT NULL DEFAULT 0,
    `userid` int(11) NOT NULL,
    `isp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `geo` int(11) NULL DEFAULT NULL,
    `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `filter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '节点筛选',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for login_ip
  -- ----------------------------
  DROP TABLE IF EXISTS `login_ip`;
  CREATE TABLE `login_ip`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userid` int(11) NOT NULL,
    `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    `type` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for payback
  -- ----------------------------
  DROP TABLE IF EXISTS `payback`;
  CREATE TABLE `payback`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `total` decimal(12, 2) NOT NULL,
    `userid` int(11) NOT NULL,
    `ref_by` int(11) NOT NULL,
    `ref_get` decimal(12, 2) NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for payback_take_log
  -- ----------------------------
  DROP TABLE IF EXISTS `payback_take_log`;
  CREATE TABLE `payback_take_log`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `type` int(11) NULL DEFAULT 0,
    `userid` int(11) NULL DEFAULT 0,
    `total` decimal(10, 2) NULL DEFAULT NULL,
    `status` int(11) NULL DEFAULT 0,
    `datetime` int(11) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for paylist
  -- ----------------------------
  DROP TABLE IF EXISTS `paylist`;
  CREATE TABLE `paylist`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userid` int(11) NOT NULL,
    `total` decimal(12, 2) NOT NULL,
    `status` int(11) NOT NULL DEFAULT 0,
    `tradeno` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `datetime` int(11) NOT NULL DEFAULT 0,
    `shop` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商店支付回调购买套餐',
    `type` int(1) NULL DEFAULT 0,
    `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for radius_ban
  -- ----------------------------
  DROP TABLE IF EXISTS `radius_ban`;
  CREATE TABLE `radius_ban`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userid` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for relay
  -- ----------------------------
  DROP TABLE IF EXISTS `relay`;
  CREATE TABLE `relay`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `source_node_id` int(11) NOT NULL,
    `dist_node_id` int(11) NOT NULL,
    `dist_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `port` int(11) NOT NULL,
    `priority` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for shop
  -- ----------------------------
  DROP TABLE IF EXISTS `shop`;
  CREATE TABLE `shop`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `price` decimal(12, 2) NOT NULL,
    `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `auto_renew` int(11) NOT NULL,
    `auto_reset_bandwidth` int(11) NOT NULL DEFAULT 0,
    `status` int(11) NOT NULL DEFAULT 1,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for speedtest
  -- ----------------------------
  DROP TABLE IF EXISTS `speedtest`;
  CREATE TABLE `speedtest`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `nodeid` int(11) NOT NULL,
    `datetime` int(11) NOT NULL,
    `telecomping` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `telecomeupload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `telecomedownload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `unicomping` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `unicomupload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `unicomdownload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `cmccping` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `cmccupload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `cmccdownload` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ss_invite_code
  -- ----------------------------
  DROP TABLE IF EXISTS `ss_invite_code`;
  CREATE TABLE `ss_invite_code`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `user_id` int(11) NOT NULL,
    `created_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
    `updated_at` timestamp(0) NOT NULL DEFAULT '2016-06-01 16:00:00',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `user_id`(`user_id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ss_node
  -- ----------------------------
  DROP TABLE IF EXISTS `ss_node`;
  CREATE TABLE `ss_node`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `type` int(11) NOT NULL,
    `server` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `protocol` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `obfs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `port` int(11) NULL DEFAULT NULL,
    `passwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `sort` int(11) NOT NULL,
    `custom_method` tinyint(4) NOT NULL DEFAULT 0,
    `traffic_rate` float NOT NULL DEFAULT 1,
    `node_class` int(11) NOT NULL DEFAULT 0,
    `node_speedlimit` decimal(12, 2) NOT NULL DEFAULT 0.00,
    `node_sort` int(11) NOT NULL DEFAULT 0,
    `node_connector` int(11) NOT NULL DEFAULT 0,
    `node_bandwidth` bigint(20) NOT NULL DEFAULT 0,
    `node_bandwidth_limit` bigint(20) NOT NULL DEFAULT 0,
    `bandwidthlimit_resetday` int(11) NOT NULL DEFAULT 0,
    `node_heartbeat` bigint(20) NOT NULL DEFAULT 0,
    `node_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `node_group` int(11) NOT NULL DEFAULT 0,
    `custom_rss` int(11) NOT NULL DEFAULT 0,
    `mu_only` int(11) NULL DEFAULT 0,
    `online` tinyint(1) NOT NULL DEFAULT 1,
    `gfw_block` tinyint(1) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ss_node_info
  -- ----------------------------
  DROP TABLE IF EXISTS `ss_node_info`;
  CREATE TABLE `ss_node_info`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `node_id` int(11) NOT NULL,
    `uptime` float NOT NULL,
    `load` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `log_time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1072 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ss_node_online_log
  -- ----------------------------
  DROP TABLE IF EXISTS `ss_node_online_log`;
  CREATE TABLE `ss_node_online_log`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `node_id` int(11) NOT NULL,
    `online_user` int(11) NOT NULL,
    `log_time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ss_password_reset
  -- ----------------------------
  DROP TABLE IF EXISTS `ss_password_reset`;
  CREATE TABLE `ss_password_reset`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `email` varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
    `token` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
    `init_time` int(11) NOT NULL,
    `expire_time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for telegram_session
  -- ----------------------------
  DROP TABLE IF EXISTS `telegram_session`;
  CREATE TABLE `telegram_session`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `type` int(11) NOT NULL,
    `session_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for telegram_tasks
  -- ----------------------------
  DROP TABLE IF EXISTS `telegram_tasks`;
  CREATE TABLE `telegram_tasks`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `type` int(8) NOT NULL COMMENT '任务类型',
    `status` int(2) NOT NULL DEFAULT 0 COMMENT '任务状态',
    `chatid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT 'Telegram Chat ID',
    `messageid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT 'Telegram Message ID',
    `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '任务详细内容',
    `process` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '临时任务进度',
    `userid` int(11) NOT NULL DEFAULT 0 COMMENT '网站用户 ID',
    `tguserid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT 'Telegram User ID',
    `executetime` int(11) NOT NULL COMMENT '任务执行时间',
    `datetime` int(11) NOT NULL COMMENT '任务产生时间',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'Telegram 任务列表' ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for ticket
  -- ----------------------------
  DROP TABLE IF EXISTS `ticket`;
  CREATE TABLE `ticket`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `rootid` int(11) NOT NULL,
    `userid` int(11) NOT NULL,
    `datetime` int(11) NOT NULL,
    `status` int(11) NOT NULL DEFAULT 1,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for unblockip
  -- ----------------------------
  DROP TABLE IF EXISTS `unblockip`;
  CREATE TABLE `unblockip`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `datetime` int(11) NOT NULL,
    `userid` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for user
  -- ----------------------------
  DROP TABLE IF EXISTS `user`;
  CREATE TABLE `user`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `pass` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `passwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'uuid',
    `t` int(11) NOT NULL DEFAULT 0,
    `u` int(11) NOT NULL,
    `d` bigint(20) NOT NULL,
    `plan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'A',
    `transfer_enable` bigint(20) NOT NULL,
    `port` int(11) NOT NULL,
    `switch` tinyint(4) NOT NULL DEFAULT 1,
    `enable` tinyint(4) NOT NULL DEFAULT 1,
    `last_detect_ban_time` datetime(0) NULL DEFAULT '1989-06-04 00:05:00',
    `all_detect_number` int(11) NOT NULL DEFAULT 0,
    `type` tinyint(4) NOT NULL DEFAULT 1,
    `last_get_gift_time` int(11) NOT NULL DEFAULT 0,
    `last_check_in_time` int(11) NOT NULL DEFAULT 0,
    `last_rest_pass_time` int(11) NOT NULL DEFAULT 0,
    `reg_date` datetime(0) NOT NULL,
    `invite_num` int(8) NOT NULL,
    `money` decimal(12, 2) NOT NULL,
    `ref_by` int(11) NOT NULL DEFAULT 0,
    `expire_time` int(11) NOT NULL DEFAULT 0,
    `method` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'rc4-md5',
    `is_email_verify` tinyint(4) NOT NULL DEFAULT 0,
    `reg_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '127.0.0.1',
    `node_speedlimit` decimal(12, 2) NOT NULL DEFAULT 0.00,
    `node_connector` int(11) NOT NULL DEFAULT 0,
    `is_admin` int(2) NOT NULL DEFAULT 0,
    `im_type` int(11) NULL DEFAULT 1,
    `im_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `last_day_t` bigint(20) NOT NULL DEFAULT 0,
    `sendDailyMail` int(11) NOT NULL DEFAULT 0,
    `class` int(11) NOT NULL DEFAULT 0,
    `class_expire` datetime(0) NOT NULL DEFAULT '1989-06-04 00:05:00',
    `expire_in` datetime(0) NOT NULL DEFAULT '2099-06-04 00:05:00',
    `theme` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `ga_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `ga_enable` int(11) NOT NULL DEFAULT 0,
    `pac` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `node_group` int(11) NOT NULL DEFAULT 0,
    `auto_reset_day` int(11) NOT NULL DEFAULT 0,
    `auto_reset_bandwidth` decimal(12, 2) NOT NULL DEFAULT 0.00,
    `protocol` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'origin',
    `protocol_param` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `obfs` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'plain',
    `obfs_param` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `forbidden_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `forbidden_port` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `disconnect_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `is_hide` int(11) NOT NULL DEFAULT 0,
    `is_multi_user` int(11) NOT NULL DEFAULT 0,
    `telegram_id` bigint(20) NULL DEFAULT NULL,
    `expire_notified` tinyint(1) NOT NULL DEFAULT 0,
    `traffic_notified` tinyint(1) NULL DEFAULT 0,
    `c_rebate` int(11) NOT NULL DEFAULT 0 COMMENT '循环返利',
    `rebate` int(11) NOT NULL DEFAULT -1 COMMENT '返利百分比',
    `back_money` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '返利金额',
    `agent` int(2) NOT NULL DEFAULT 0 COMMENT '代理商',
    `config` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户配置',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `user_name`(`user_name`) USING BTREE,
    INDEX `uid`(`id`) USING BTREE,
    INDEX `email`(`email`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for user_subscribe_log
  -- ----------------------------
  DROP TABLE IF EXISTS `user_subscribe_log`;
  CREATE TABLE `user_subscribe_log`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
    `user_id` int(11) NOT NULL COMMENT '用户 ID',
    `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户邮箱',
    `subscribe_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '获取的订阅类型',
    `request_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求 IP',
    `request_time` datetime(0) NOT NULL COMMENT '请求时间',
    `request_user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求 UA 信息',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户订阅日志' ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for user_token
  -- ----------------------------
  DROP TABLE IF EXISTS `user_token`;
  CREATE TABLE `user_token`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `user_id` int(11) NOT NULL,
    `create_time` int(11) NOT NULL,
    `expire_time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  -- ----------------------------
  -- Table structure for user_traffic_log
  -- ----------------------------
  DROP TABLE IF EXISTS `user_traffic_log`;
  CREATE TABLE `user_traffic_log`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `u` int(11) NOT NULL,
    `d` int(11) NOT NULL,
    `node_id` int(11) NOT NULL,
    `rate` float NOT NULL,
    `traffic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `log_time` int(11) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
  
  SET FOREIGN_KEY_CHECKS = 1;
  