v2board/database/install.sql

380 lines
20 KiB
MySQL
Raw Normal View History

2021-12-28 01:49:33 +08:00
-- Adminer 4.8.1 MySQL 5.7.29 dump
2019-10-29 15:33:36 +08:00
SET NAMES utf8;
2020-12-22 15:21:18 +08:00
SET time_zone = '+00:00';
2019-10-29 15:33:36 +08:00
SET foreign_key_checks = 0;
2020-12-22 15:21:18 +08:00
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
2019-10-29 15:33:36 +08:00
2019-12-31 17:49:24 +08:00
SET NAMES utf8mb4;
2020-02-13 13:43:55 +08:00
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE `failed_jobs` (
2021-01-21 22:29:15 +08:00
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
2021-04-28 16:56:08 +08:00
`failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
2021-01-21 22:29:15 +08:00
PRIMARY KEY (`id`)
2020-02-13 13:43:55 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2020-02-14 18:24:59 +08:00
2021-09-18 20:04:35 +08:00
DROP TABLE IF EXISTS `v2_commission_log`;
CREATE TABLE `v2_commission_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invite_user_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`trade_no` char(36) NOT NULL,
`order_amount` int(11) NOT NULL,
`get_amount` int(11) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2019-12-31 17:49:24 +08:00
DROP TABLE IF EXISTS `v2_coupon`;
CREATE TABLE `v2_coupon` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(255) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`type` tinyint(1) NOT NULL,
`value` int(11) NOT NULL,
2022-01-22 02:30:05 +08:00
`show` tinyint(1) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`limit_use` int(11) DEFAULT NULL,
2021-08-28 15:32:55 +08:00
`limit_use_with_user` int(11) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`limit_plan_ids` varchar(255) DEFAULT NULL,
2021-12-28 01:49:33 +08:00
`limit_period` varchar(255) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`started_at` int(11) NOT NULL,
`ended_at` int(11) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-12-31 17:49:24 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2019-10-29 15:33:36 +08:00
DROP TABLE IF EXISTS `v2_invite_code`;
CREATE TABLE `v2_invite_code` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`code` char(32) NOT NULL,
2021-04-28 16:56:08 +08:00
`status` tinyint(1) NOT NULL DEFAULT '0',
`pv` int(11) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-10-29 15:33:36 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `v2_knowledge`;
CREATE TABLE `v2_knowledge` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`language` char(5) NOT NULL COMMENT '語言',
`category` varchar(255) NOT NULL COMMENT '分類名',
`title` varchar(255) NOT NULL COMMENT '標題',
`body` text NOT NULL COMMENT '內容',
`sort` int(11) DEFAULT NULL COMMENT '排序',
2021-04-28 16:56:08 +08:00
`show` tinyint(1) NOT NULL DEFAULT '0' COMMENT '顯示',
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL COMMENT '創建時間',
`updated_at` int(11) NOT NULL COMMENT '更新時間',
PRIMARY KEY (`id`)
2020-12-22 15:21:18 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='知識庫';
2019-12-30 21:05:48 +08:00
DROP TABLE IF EXISTS `v2_mail_log`;
CREATE TABLE `v2_mail_log` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(64) NOT NULL,
`subject` varchar(255) NOT NULL,
`template_name` varchar(255) NOT NULL,
2021-04-28 16:56:08 +08:00
`error` text,
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-12-30 21:05:48 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2019-12-12 13:45:46 +08:00
DROP TABLE IF EXISTS `v2_notice`;
CREATE TABLE `v2_notice` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`content` text NOT NULL,
2022-01-22 02:30:05 +08:00
`show` tinyint(1) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`img_url` varchar(255) DEFAULT NULL,
2022-04-15 02:45:52 +08:00
`tags` varchar(255) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-12-12 13:45:46 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2019-10-29 15:33:36 +08:00
DROP TABLE IF EXISTS `v2_order`;
CREATE TABLE `v2_order` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`invite_user_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
`plan_id` int(11) NOT NULL,
`coupon_id` int(11) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`payment_id` int(11) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`type` int(11) NOT NULL COMMENT '1新购2续费3升级',
2021-12-28 01:49:33 +08:00
`period` varchar(255) NOT NULL,
2021-01-21 22:29:15 +08:00
`trade_no` varchar(36) NOT NULL,
`callback_no` varchar(255) DEFAULT NULL,
`total_amount` int(11) NOT NULL,
2022-03-17 14:50:02 +08:00
`handling_amount` int(11) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`discount_amount` int(11) DEFAULT NULL,
`surplus_amount` int(11) DEFAULT NULL COMMENT '剩余价值',
`refund_amount` int(11) DEFAULT NULL COMMENT '退款金额',
`balance_amount` int(11) DEFAULT NULL COMMENT '使用余额',
2021-04-28 16:56:08 +08:00
`surplus_order_ids` text COMMENT '折抵订单',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待支付1开通中2已取消3已完成4已折抵',
`commission_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待确认1发放中2有效3无效',
`commission_balance` int(11) NOT NULL DEFAULT '0',
`actual_commission_balance` int(11) DEFAULT NULL COMMENT '实际支付佣金',
2021-07-31 01:21:49 +08:00
`paid_at` int(11) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-10-29 15:33:36 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2021-04-28 16:56:08 +08:00
DROP TABLE IF EXISTS `v2_payment`;
CREATE TABLE `v2_payment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
2021-05-07 00:17:55 +08:00
`uuid` char(32) NOT NULL,
2021-04-28 16:56:08 +08:00
`payment` varchar(16) NOT NULL,
`name` varchar(255) NOT NULL,
2021-12-13 14:24:53 +08:00
`icon` varchar(255) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`config` text NOT NULL,
`notify_domain` varchar(128) DEFAULT NULL,
2022-03-17 14:50:02 +08:00
`handling_fee_fixed` int(11) DEFAULT NULL,
`handling_fee_percent` decimal(5,2) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`enable` tinyint(1) NOT NULL DEFAULT '0',
`sort` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2019-10-29 15:33:36 +08:00
DROP TABLE IF EXISTS `v2_plan`;
CREATE TABLE `v2_plan` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`transfer_enable` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
2021-04-28 16:56:08 +08:00
`show` tinyint(1) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`sort` int(11) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`renew` tinyint(1) NOT NULL DEFAULT '1',
`content` text,
2021-01-21 22:29:15 +08:00
`month_price` int(11) DEFAULT NULL,
`quarter_price` int(11) DEFAULT NULL,
`half_year_price` int(11) DEFAULT NULL,
`year_price` int(11) DEFAULT NULL,
`two_year_price` int(11) DEFAULT NULL,
`three_year_price` int(11) DEFAULT NULL,
`onetime_price` int(11) DEFAULT NULL,
`reset_price` int(11) DEFAULT NULL,
2021-09-21 17:51:53 +08:00
`reset_traffic_method` tinyint(1) DEFAULT NULL,
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-10-29 15:33:36 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `v2_server_group`;
CREATE TABLE `v2_server_group` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-10-29 15:33:36 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2020-10-04 14:21:09 +08:00
DROP TABLE IF EXISTS `v2_server_shadowsocks`;
CREATE TABLE `v2_server_shadowsocks` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` varchar(255) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`rate` varchar(11) NOT NULL,
`host` varchar(255) NOT NULL,
`port` int(11) NOT NULL,
`server_port` int(11) NOT NULL,
`cipher` varchar(255) NOT NULL,
2021-04-28 16:56:08 +08:00
`show` tinyint(4) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`sort` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2020-10-04 14:21:09 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2020-06-08 01:08:07 +08:00
DROP TABLE IF EXISTS `v2_server_trojan`;
CREATE TABLE `v2_server_trojan` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '节点ID',
`group_id` varchar(255) NOT NULL COMMENT '节点组',
`parent_id` int(11) DEFAULT NULL COMMENT '父节点',
`tags` varchar(255) DEFAULT NULL COMMENT '节点标签',
`name` varchar(255) NOT NULL COMMENT '节点名称',
`rate` varchar(11) NOT NULL COMMENT '倍率',
`host` varchar(255) NOT NULL COMMENT '主机名',
`port` int(11) NOT NULL COMMENT '连接端口',
`server_port` int(11) NOT NULL COMMENT '服务端口',
2021-04-28 16:56:08 +08:00
`allow_insecure` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许不安全',
2021-01-21 22:29:15 +08:00
`server_name` varchar(255) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`show` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否显示',
2021-01-21 22:29:15 +08:00
`sort` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2020-12-22 15:21:18 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='trojan伺服器表';
2020-12-20 16:57:33 +08:00
2021-09-21 18:07:53 +08:00
DROP TABLE IF EXISTS `v2_server_v2ray`;
CREATE TABLE `v2_server_v2ray` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` varchar(255) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`host` varchar(255) NOT NULL,
2022-02-17 03:17:05 +08:00
`port` char(11) NOT NULL,
2021-09-21 18:07:53 +08:00
`server_port` int(11) NOT NULL,
`tls` tinyint(4) NOT NULL DEFAULT '0',
`tags` varchar(255) DEFAULT NULL,
`rate` varchar(11) NOT NULL,
`network` text NOT NULL,
`rules` text,
`networkSettings` text,
`tlsSettings` text,
`ruleSettings` text,
`dnsSettings` text,
`show` tinyint(1) NOT NULL DEFAULT '0',
`sort` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2020-12-20 16:57:33 +08:00
DROP TABLE IF EXISTS `v2_stat_order`;
CREATE TABLE `v2_stat_order` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_count` int(11) NOT NULL COMMENT '订单数量',
`order_amount` int(11) NOT NULL COMMENT '订单合计',
`commission_count` int(11) NOT NULL,
`commission_amount` int(11) NOT NULL COMMENT '佣金合计',
`record_type` char(1) NOT NULL,
`record_at` int(11) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `record_at` (`record_at`)
2020-12-22 15:21:18 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单统计';
2020-04-20 16:26:23 +08:00
2020-12-20 02:49:37 +08:00
DROP TABLE IF EXISTS `v2_stat_server`;
CREATE TABLE `v2_stat_server` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL COMMENT '节点id',
`server_type` char(11) NOT NULL COMMENT '节点类型',
2022-03-11 01:12:49 +08:00
`u` bigint(20) NOT NULL,
`d` bigint(20) NOT NULL,
2021-01-21 22:29:15 +08:00
`record_type` char(1) NOT NULL COMMENT 'd day m month',
`record_at` int(11) NOT NULL COMMENT '记录时间',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `server_id_server_type_record_at` (`server_id`,`server_type`,`record_at`),
KEY `record_at` (`record_at`),
KEY `server_id` (`server_id`)
2020-12-22 15:21:18 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='节点数据统计';
2020-12-20 02:49:37 +08:00
2022-02-20 01:06:02 +08:00
DROP TABLE IF EXISTS `v2_stat_user`;
CREATE TABLE `v2_stat_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`server_rate` decimal(10,2) NOT NULL,
`u` bigint(20) NOT NULL,
`d` bigint(20) NOT NULL,
`record_type` char(2) NOT NULL,
`record_at` int(11) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
2022-02-25 17:10:43 +08:00
PRIMARY KEY (`id`),
2022-03-29 14:57:09 +08:00
UNIQUE KEY `server_rate_user_id_record_at` (`server_rate`,`user_id`,`record_at`),
2022-02-25 17:10:43 +08:00
KEY `user_id` (`user_id`),
2022-03-29 14:57:09 +08:00
KEY `record_at` (`record_at`),
KEY `server_rate` (`server_rate`)
2022-02-20 01:06:02 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2019-12-13 17:07:46 +08:00
DROP TABLE IF EXISTS `v2_ticket`;
CREATE TABLE `v2_ticket` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`subject` varchar(255) NOT NULL,
`level` tinyint(1) NOT NULL,
2021-04-28 16:56:08 +08:00
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:已开启 1:已关闭',
2022-04-28 00:58:37 +08:00
`reply_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0:待回复 1:已回复',
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-12-13 17:07:46 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `v2_ticket_message`;
CREATE TABLE `v2_ticket_message` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`ticket_id` int(11) NOT NULL,
`message` text CHARACTER SET utf8mb4 NOT NULL,
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
2019-12-13 17:07:46 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2019-10-29 15:33:36 +08:00
DROP TABLE IF EXISTS `v2_user`;
CREATE TABLE `v2_user` (
2021-01-21 22:29:15 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`invite_user_id` int(11) DEFAULT NULL,
`telegram_id` bigint(20) DEFAULT NULL,
`email` varchar(64) NOT NULL,
`password` varchar(64) NOT NULL,
`password_algo` char(10) DEFAULT NULL,
2021-09-14 12:10:29 +08:00
`password_salt` char(10) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`balance` int(11) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`discount` int(11) DEFAULT NULL,
2022-01-05 01:11:24 +08:00
`commission_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0: system 1: period 2: onetime',
2021-01-21 22:29:15 +08:00
`commission_rate` int(11) DEFAULT NULL,
2021-04-28 16:56:08 +08:00
`commission_balance` int(11) NOT NULL DEFAULT '0',
`t` int(11) NOT NULL DEFAULT '0',
`u` bigint(20) NOT NULL DEFAULT '0',
`d` bigint(20) NOT NULL DEFAULT '0',
`transfer_enable` bigint(20) NOT NULL DEFAULT '0',
`banned` tinyint(1) NOT NULL DEFAULT '0',
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
`is_staff` tinyint(1) NOT NULL DEFAULT '0',
2021-01-21 22:29:15 +08:00
`last_login_at` int(11) DEFAULT NULL,
`last_login_ip` int(11) DEFAULT NULL,
`uuid` varchar(36) NOT NULL,
`group_id` int(11) DEFAULT NULL,
`plan_id` int(11) DEFAULT NULL,
2022-04-09 16:08:36 +08:00
`remind_expire` tinyint(4) DEFAULT '1',
`remind_traffic` tinyint(4) DEFAULT '1',
2021-01-21 22:29:15 +08:00
`token` char(32) NOT NULL,
2021-04-28 16:56:08 +08:00
`remarks` text,
`expired_at` bigint(20) DEFAULT '0',
2021-01-21 22:29:15 +08:00
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`),
2021-07-01 19:06:09 +08:00
UNIQUE KEY `email` (`email`)
2019-10-29 15:33:36 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2022-05-02 03:50:36 +08:00
-- 2022-05-01 17:06:46