-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- 主机： localhost
-- 生成日期： 2026-04-10 18:14:23
-- 服务器版本： 5.7.44-log
-- PHP 版本： 7.3.31

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- 数据库： `installcs2`
--

-- --------------------------------------------------------

--
-- 表的结构 `agent_applications`
--

CREATE TABLE `agent_applications` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `agent_name` varchar(100) NOT NULL,
  `contact_phone` varchar(20) DEFAULT NULL,
  `contact_qq` varchar(20) DEFAULT NULL,
  `contact_wechat` varchar(50) DEFAULT NULL,
  `reason` text,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `admin_remark` text,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代理商申请表';

-- --------------------------------------------------------

--
-- 表的结构 `agent_apps`
--

CREATE TABLE `agent_apps` (
  `id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `app_id` int(11) NOT NULL,
  `agent_price` decimal(10,2) NOT NULL,
  `commission_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `discount_value` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_type` enum('percent','fixed') NOT NULL DEFAULT 'percent',
  `stack_discount` tinyint(1) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代理商可销售应用表';

-- --------------------------------------------------------

--
-- 表的结构 `agent_app_applications`
--

CREATE TABLE `agent_app_applications` (
  `id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `app_id` int(11) NOT NULL,
  `requested_price` decimal(10,2) NOT NULL,
  `requested_commission` decimal(5,2) NOT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `admin_remark` text,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代理商应用申请表';

-- --------------------------------------------------------

--
-- 表的结构 `agent_orders`
--

CREATE TABLE `agent_orders` (
  `id` int(11) NOT NULL,
  `order_no` varchar(32) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `customer_id` int(11) NOT NULL,
  `app_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `agent_commission` decimal(10,2) NOT NULL,
  `status` enum('pending','paid','cancelled') NOT NULL DEFAULT 'pending',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `paid_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代理商订单表';

-- --------------------------------------------------------

--
-- 表的结构 `agent_products`
--

CREATE TABLE `agent_products` (
  `id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text,
  `price` decimal(10,2) NOT NULL,
  `duration_days` int(11) NOT NULL DEFAULT '0',
  `commission_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `discount_value` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_type` enum('percent','fixed') NOT NULL DEFAULT 'percent',
  `stack_discount` tinyint(1) NOT NULL DEFAULT '0',
  `images` text,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `admin_remark` text,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代理商产品表';

-- --------------------------------------------------------

--
-- 表的结构 `agent_withdrawals`
--

CREATE TABLE `agent_withdrawals` (
  `id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `withdrawal_method` enum('alipay','wechat','bank') NOT NULL,
  `account` varchar(100) NOT NULL,
  `account_name` varchar(100) DEFAULT NULL,
  `status` enum('pending','processing','completed','rejected') NOT NULL DEFAULT 'pending',
  `admin_remark` text,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='佣金提现记录表';

-- --------------------------------------------------------

--
-- 表的结构 `announcements`
--

CREATE TABLE `announcements` (
  `id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL,
  `content` text NOT NULL,
  `type` enum('user_dashboard','user_register','user_buy','admin') NOT NULL DEFAULT 'user_dashboard',
  `position` enum('popup','banner','sidebar') NOT NULL DEFAULT 'popup',
  `priority` int(11) NOT NULL DEFAULT '0',
  `start_time` datetime DEFAULT NULL,
  `end_time` datetime DEFAULT NULL,
  `show_frequency` tinyint(1) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告表';

-- --------------------------------------------------------

--
-- 表的结构 `announcement_reads`
--

CREATE TABLE `announcement_reads` (
  `id` int(11) NOT NULL,
  `announcement_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `read_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告已读记录表';

-- --------------------------------------------------------

--
-- 表的结构 `apps`
--

CREATE TABLE `apps` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `app_key` varchar(64) NOT NULL DEFAULT '',
  `description` text,
  `price` decimal(10,2) NOT NULL,
  `duration_days` int(11) NOT NULL COMMENT '0永久',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `balance_logs`
--

CREATE TABLE `balance_logs` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `type` enum('recharge','consume','refund') NOT NULL,
  `remark` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `card_codes`
--

CREATE TABLE `card_codes` (
  `id` int(11) NOT NULL,
  `card_code` varchar(32) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` tinyint(4) DEFAULT '0',
  `used_by` int(11) DEFAULT NULL,
  `used_at` datetime DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `expire_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='卡密表';

-- --------------------------------------------------------

--
-- 表的结构 `changelog`
--

CREATE TABLE `changelog` (
  `id` int(11) NOT NULL,
  `version` varchar(20) NOT NULL,
  `release_date` date NOT NULL,
  `content` text NOT NULL,
  `is_featured` tinyint(1) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='更新日志表';

-- --------------------------------------------------------

--
-- 表的结构 `downloads`
--

CREATE TABLE `downloads` (
  `id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL,
  `description` text,
  `file_name` varchar(255) NOT NULL,
  `file_path` varchar(500) NOT NULL,
  `file_size` varchar(50) DEFAULT NULL,
  `download_count` int(11) NOT NULL DEFAULT '0',
  `version` varchar(50) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `sort` int(11) NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='资源下载表';

-- --------------------------------------------------------

--
-- 表的结构 `email_log`
--

CREATE TABLE `email_log` (
  `id` int(11) NOT NULL,
  `to_email` varchar(100) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `content` text,
  `status` tinyint(4) DEFAULT '0',
  `error_msg` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='邮件发送日志表';

-- --------------------------------------------------------

--
-- 表的结构 `email_templates`
--

CREATE TABLE `email_templates` (
  `id` int(11) NOT NULL,
  `type` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `content` text NOT NULL,
  `variables` text,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `payment_methods` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='邮件模板表';

--
-- 转存表中的数据 `email_templates`
--

INSERT INTO `email_templates` (`id`, `type`, `name`, `subject`, `content`, `variables`, `updated_at`, `payment_methods`) VALUES
(1, 'recharge', '充值成功通知', '【{site_name}】充值成功通知', '<!DOCTYPE html>\n<html>\n<head><meta charset=\"UTF-8\"></head>\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\n        <div style=\"background: linear-gradient(135deg, #10b981, #059669); padding: 30px; text-align: center;\">\n            <h2 style=\"color: white; margin: 0;\">✅ 充值成功</h2>\n        </div>\n        <div style=\"padding: 30px;\">\n            <p>尊敬的 {username}，您好！</p>\n            <p>您的账户已成功充值：</p>\n            <div style=\"text-align: center; margin: 30px 0;\">\n                <span style=\"font-size: 36px; font-weight: bold; color: #10b981;\">¥{amount}</span>\n            </div>\n            <p>订单号：{order_no}</p>\n            <p>当前余额：<strong>¥{balance}</strong></p>\n            <hr style=\"margin: 30px 0;\">\n            <p style=\"color: #9ca3af; font-size: 12px;\">此邮件由系统自动发送，请勿回复。</p>\n        </div>\n    </div>\n</body>\n</html>', '{site_name}, {username}, {amount}, {order_no}, {balance}', '2026-04-09 15:27:07', NULL),
(2, 'card_recharge', '卡密充值成功通知', '【{site_name}】卡密充值成功通知', '<!DOCTYPE html>\n<html>\n<head><meta charset=\"UTF-8\"></head>\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\n        <div style=\"background: linear-gradient(135deg, #f59e0b, #ef4444); padding: 30px; text-align: center;\">\n            <h2 style=\"color: white; margin: 0;\">🎫 卡密充值成功</h2>\n        </div>\n        <div style=\"padding: 30px;\">\n            <p>尊敬的 {username}，您好！</p>\n            <p>您已通过卡密成功充值：</p>\n            <div style=\"text-align: center; margin: 30px 0;\">\n                <span style=\"font-size: 36px; font-weight: bold; color: #f59e0b;\">¥{amount}</span>\n            </div>\n            <p>卡密：{card_code}</p>\n            <p>当前余额：<strong>¥{balance}</strong></p>\n            <hr style=\"margin: 30px 0;\">\n            <p style=\"color: #9ca3af; font-size: 12px;\">此邮件由系统自动发送，请勿回复。</p>\n        </div>\n    </div>\n</body>\n</html>', '{site_name}, {username}, {amount}, {card_code}, {balance}', '2026-04-09 15:27:07', NULL),
(3, 'login_alert', '登录提醒', '【{site_name}】登录提醒', '<!DOCTYPE html>\n<html>\n<head><meta charset=\"UTF-8\"></head>\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\n        <div style=\"background: linear-gradient(135deg, #667eea, #764ba2); padding: 30px; text-align: center;\">\n            <h2 style=\"color: white; margin: 0;\">🔐 登录提醒</h2>\n        </div>\n        <div style=\"padding: 30px;\">\n            <p>尊敬的 {username}，您好！</p>\n            <p>您的账号刚刚登录：</p>\n            <div style=\"margin: 20px 0; padding: 15px; background: #f3f4f6; border-radius: 12px;\">\n                <p>📅 登录时间：{login_time}</p>\n                <p>📍 登录位置：{city}</p>\n                <p>📱 设备信息：{device}</p>\n                <p>🌐 IP地址：{ip}</p>\n            </div>\n            <p>如果这是您本人操作，请忽略此邮件。</p>\n            <p style=\"color: #ef4444;\">⚠️ 如果不是您本人操作，请立即修改密码。</p>\n        </div>\n    </div>\n</body>\n</html>', '{site_name}, {username}, {login_time}, {city}, {device}, {ip}', '2026-04-09 15:27:07', NULL),
(4, 'consume', '消费成功通知', '【{site_name}】购买成功通知', '<!DOCTYPE html>\r\n<html>\r\n<head><meta charset=\"UTF-8\"></head>\r\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\r\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\r\n        <div style=\"background: linear-gradient(135deg, #667eea, #764ba2); padding: 30px; text-align: center;\">\r\n            <h2 style=\"color: white; margin: 0;\">       消费成功通知\r\n</h2>\r\n        </div>\r\n        <div style=\"padding: 30px;\">\r\n            <p>尊敬的 {username}，您好！</p>\r\n            <p>您已成功购买：</p>\r\n            <div style=\"margin: 20px 0; padding: 15px; background: #f3f4f6; border-radius: 12px;\">\r\n                <p>应用名称：<strong>{item_name}</strong></p>\r\n                <p>金额：¥{amount}</p>\r\n                <p>订单号：{order_no}</p>\r\n            </div>\r\n            <hr style=\"margin: 30px 0;\">\r\n            <p style=\"color: #9ca3af; font-size: 12px;\">此邮件由系统自动发送，请勿回复。</p>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>', '{site_name}, {username}, {item_name}, {amount}, {order_no}', '2026-04-08 23:37:34', NULL),
(5, 'verify_code', '验证码邮件', '【{site_name}】{type_name}验证码', '<!DOCTYPE html>\r\n<html>\r\n<head><meta charset=\"UTF-8\"></head>\r\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\r\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\r\n        <div style=\"background: linear-gradient(135deg, #667eea, #764ba2); padding: 30px; text-align: center;\">\r\n            <h2 style=\"color: white; margin: 0;\">{{type_name}}</h2>\r\n        </div>\r\n        <div style=\"padding: 30px;\">\r\n            <p>您好！</p>\r\n            <p>您正在进行<span style=\"color: #667eea; font-weight: bold;\">{type_name}</span>操作，验证码如下：</p>\r\n            <div style=\"text-align: center; margin: 30px 0;\">\r\n                <span style=\"font-size: 32px; font-weight: bold; letter-spacing: 5px; background: #f3f4f6; padding: 12px 24px; border-radius: 12px;\">{code}</span>\r\n            </div>\r\n            <p>验证码有效期为 <strong>5分钟</strong>，请尽快完成验证。</p>\r\n            <p>如果这不是您本人操作，请忽略此邮件。</p>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>', '{site_name}, {type_name}, {code}', '2026-04-08 23:37:48', NULL),
(6, 'oauth_bind', '快捷登录绑定通知', '【{site_name}】快捷登录绑定通知', '<!DOCTYPE html>\r\n<html>\r\n<head><meta charset=\"UTF-8\"></head>\r\n<body style=\"font-family: Arial, sans-serif; padding: 20px;\">\r\n    <div style=\"max-width: 500px; margin: 0 auto; background: #f9fafb; border-radius: 16px; overflow: hidden;\">\r\n        <div style=\"background: linear-gradient(135deg, #667eea, #764ba2); padding: 30px; text-align: center;\">\r\n            <h2 style=\"color: white; margin: 0;\">{{oauth_type}}快捷登录绑定通知</h2>\r\n        </div>\r\n        <div style=\"padding: 30px;\">\r\n            <p>尊敬的 {username}，您好！</p>\r\n            <p>您的账号已成功绑定 <strong>{oauth_type}</strong> 快捷登录。</p>\r\n            <p>绑定时间：{bind_time}</p>\r\n            <p>如非本人操作，请立即修改密码并联系客服。</p>\r\n            <hr style=\"margin: 30px 0;\">\r\n            <p style=\"color: #9ca3af; font-size: 12px;\">此邮件由系统自动发送，请勿回复。</p>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>', '{site_name}, {username}, {oauth_type}, {bind_time}', '2026-04-08 23:37:56', NULL);

-- --------------------------------------------------------

--
-- 表的结构 `email_verify_codes`
--

CREATE TABLE `email_verify_codes` (
  `id` int(11) NOT NULL,
  `email` varchar(100) NOT NULL,
  `code` varchar(10) NOT NULL,
  `type` enum('register','login','bind','reset') DEFAULT 'register',
  `used` tinyint(4) DEFAULT '0',
  `expired_at` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='邮箱验证码表';

-- --------------------------------------------------------

--
-- 表的结构 `encrypt_coupons`
--

CREATE TABLE `encrypt_coupons` (
  `id` int(11) NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `type` enum('fixed','percent') DEFAULT 'fixed',
  `value` decimal(10,2) NOT NULL,
  `min_amount` decimal(10,2) DEFAULT '0.00',
  `max_discount` decimal(10,2) DEFAULT NULL,
  `usage_limit` int(11) DEFAULT '1',
  `used_count` int(11) DEFAULT '0',
  `expire_date` datetime DEFAULT NULL,
  `applicable_packages` text,
  `status` tinyint(4) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `encrypt_coupon_usage`
--

CREATE TABLE `encrypt_coupon_usage` (
  `id` int(11) NOT NULL,
  `coupon_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `order_amount` decimal(10,2) NOT NULL,
  `discount_amount` decimal(10,2) NOT NULL,
  `used_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `encrypt_history`
--

CREATE TABLE `encrypt_history` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `original_name` varchar(255) NOT NULL,
  `file_size` int(11) DEFAULT NULL,
  `encrypted_size` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `bind_domain` varchar(255) DEFAULT NULL,
  `bind_type` enum('exact','wildcard') DEFAULT 'exact',
  `language` varchar(20) DEFAULT 'php'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='加密历史记录';

-- --------------------------------------------------------

--
-- 表的结构 `encrypt_packages`
--

CREATE TABLE `encrypt_packages` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `days` int(11) DEFAULT NULL,
  `price` decimal(10,2) NOT NULL,
  `sort_order` int(11) DEFAULT '0',
  `status` tinyint(4) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `encrypt_services`
--

CREATE TABLE `encrypt_services` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `service_name` varchar(100) NOT NULL DEFAULT 'php_encrypt',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `expire_date` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `package_type` varchar(20) DEFAULT 'permanent',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='加密服务购买记录';

-- --------------------------------------------------------

--
-- 表的结构 `invite_records`
--

CREATE TABLE `invite_records` (
  `id` int(11) NOT NULL,
  `inviter_id` int(11) NOT NULL,
  `invitee_id` int(11) NOT NULL,
  `invite_code` varchar(20) NOT NULL,
  `status` tinyint(4) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `licenses`
--

CREATE TABLE `licenses` (
  `id` int(11) NOT NULL,
  `license_code` varchar(64) NOT NULL,
  `app_id` int(11) NOT NULL,
  `app_key` varchar(64) NOT NULL DEFAULT '',
  `user_id` int(11) NOT NULL,
  `domain` varchar(255) DEFAULT NULL,
  `expire_date` date DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `used` tinyint(1) NOT NULL DEFAULT '0',
  `used_at` datetime DEFAULT NULL,
  `used_domain` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `links`
--

CREATE TABLE `links` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `url` varchar(255) NOT NULL,
  `type` enum('friend','header') NOT NULL DEFAULT 'friend',
  `sort` int(11) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `parent_id` int(11) DEFAULT '0' COMMENT '父菜单ID，0表示顶级菜单',
  `is_dropdown` tinyint(4) DEFAULT '0' COMMENT '是否作为下拉菜单：1是 0否'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- 转存表中的数据 `links`
--

INSERT INTO `links` (`id`, `name`, `url`, `type`, `sort`, `status`, `parent_id`, `is_dropdown`) VALUES
(1, '首页', '/', 'header', 1, 1, 0, 0),
(2, '授权查询', '/modules/home/query.php', 'header', 2, 1, 15, 0),
(3, '购买授权', '/modules/home/buy.php', 'header', 3, 1, 15, 0),
(4, '联系我们', '/modules/home/contact.php', 'header', 4, 1, 15, 0),
(5, '官方博客', 'https://blog.lhwks.icu', 'friend', 1, 1, 0, 0),
(6, '官网', 'https://www.lhwks.icu', 'friend', 0, 1, 0, 0),
(8, '关于我们', '/modules/home/about.php', 'header', 5, 1, 15, 0),
(10, 'PHP加密', '/encrypt', 'header', 7, 1, 0, 0),
(11, '麟泓支付', 'https://pay.lhwks.icu/', 'friend', 2, 1, 0, 0),
(14, '技术文档', '/docs.php', 'header', 9, 1, 0, 0),
(15, '常用功能', '#', 'header', 2, 1, 0, 1);

-- --------------------------------------------------------

--
-- 表的结构 `login_fail_log`
--

CREATE TABLE `login_fail_log` (
  `id` int(11) NOT NULL,
  `ip` varchar(45) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `fail_count` int(11) DEFAULT '1',
  `last_fail_time` datetime NOT NULL,
  `lock_until` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='登录失败记录表';

-- --------------------------------------------------------

--
-- 表的结构 `orders`
--

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `order_no` varchar(32) NOT NULL,
  `user_id` int(11) NOT NULL,
  `type` enum('app','group','recharge') NOT NULL DEFAULT 'app',
  `item_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` varchar(50) DEFAULT NULL,
  `status` enum('pending','paid','cancelled') NOT NULL DEFAULT 'pending',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `expire_at` datetime DEFAULT NULL,
  `paid_at` datetime DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `quick_login_config`
--

CREATE TABLE `quick_login_config` (
  `id` int(11) NOT NULL,
  `type` varchar(30) NOT NULL,
  `name` varchar(50) NOT NULL,
  `enabled` tinyint(4) DEFAULT '0',
  `sort` int(11) DEFAULT '0',
  `icon` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `rebate_records`
--

CREATE TABLE `rebate_records` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `from_user_id` int(11) NOT NULL,
  `order_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `rate` decimal(5,2) NOT NULL,
  `status` tinyint(4) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `settled_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `site_config`
--

CREATE TABLE `site_config` (
  `key` varchar(100) NOT NULL,
  `value` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- 转存表中的数据 `site_config`
--

INSERT INTO `site_config` (`key`, `value`) VALUES
('contact_info', ''),
('register_enabled', '1'),
('site_copyright', ''),
('site_icp', ''),
('site_keywords', ''),
('site_logo', '/assets/uploads/logo_1775736137.png'),
('site_name', '自主更名-麟泓授权系统'),
('sys_version', '1.0.0');

-- --------------------------------------------------------

--
-- 表的结构 `tickets`
--

CREATE TABLE `tickets` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `content` text NOT NULL,
  `status` enum('open','processing','closed') NOT NULL DEFAULT 'open',
  `priority` enum('low','medium','high') NOT NULL DEFAULT 'medium',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `ticket_replies`
--

CREATE TABLE `ticket_replies` (
  `id` int(11) NOT NULL,
  `ticket_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `content` text NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `updates`
--

CREATE TABLE `updates` (
  `id` int(11) NOT NULL,
  `version` varchar(20) NOT NULL,
  `release_notes` text,
  `package_url` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(100) NOT NULL,
  `avatar` varchar(255) DEFAULT '/assets/uploads/default_avatar.png',
  `balance` decimal(10,2) NOT NULL DEFAULT '0.00',
  `group_id` int(11) DEFAULT NULL,
  `role` enum('admin','employee','user') NOT NULL DEFAULT 'user',
  `is_agent` tinyint(1) NOT NULL DEFAULT '0',
  `agent_commission_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `agent_total_commission` decimal(10,2) NOT NULL DEFAULT '0.00',
  `agent_withdrawn` decimal(10,2) NOT NULL DEFAULT '0.00',
  `agent_level` tinyint(1) NOT NULL DEFAULT '1',
  `permissions` json DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `email_notify` tinyint(4) DEFAULT '1',
  `last_notify_at` datetime DEFAULT NULL,
  `email_verified` tinyint(4) DEFAULT '0',
  `gitee_id` varchar(100) DEFAULT NULL,
  `gitee_name` varchar(100) DEFAULT NULL,
  `avatar_url` varchar(500) DEFAULT NULL,
  `union_id` varchar(100) DEFAULT NULL,
  `union_type` varchar(20) DEFAULT NULL,
  `need_change_password` tinyint(4) DEFAULT '0',
  `is_oauth_user` tinyint(4) DEFAULT '0',
  `invite_code` varchar(20) DEFAULT NULL,
  `rebate_balance` decimal(10,2) DEFAULT '0.00',
  `feishu_id` varchar(100) DEFAULT NULL,
  `feishu_name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `user_groups`
--

CREATE TABLE `user_groups` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` text,
  `price` decimal(10,2) NOT NULL DEFAULT '0.00',
  `discount` decimal(5,2) NOT NULL DEFAULT '100.00',
  `duration_days` int(11) NOT NULL DEFAULT '0',
  `sort` int(11) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `user_group_purchases`
--

CREATE TABLE `user_group_purchases` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `expire_date` date DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `user_login_log`
--

CREATE TABLE `user_login_log` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `ip` varchar(45) NOT NULL,
  `city` varchar(100) DEFAULT NULL,
  `device` varchar(255) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `user_oauth_bindings`
--

CREATE TABLE `user_oauth_bindings` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `oauth_type` varchar(30) NOT NULL,
  `openid` varchar(100) NOT NULL,
  `nickname` varchar(100) DEFAULT NULL,
  `avatar` varchar(500) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- 表的结构 `user_version_reminders`
--

CREATE TABLE `user_version_reminders` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `version` varchar(20) NOT NULL,
  `reminded_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户版本更新提醒记录表';

-- --------------------------------------------------------

--
-- 表的结构 `withdraw_records`
--

CREATE TABLE `withdraw_records` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` tinyint(4) DEFAULT '0',
  `remark` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- 转储表的索引
--

--
-- 表的索引 `agent_applications`
--
ALTER TABLE `agent_applications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- 表的索引 `agent_apps`
--
ALTER TABLE `agent_apps`
  ADD PRIMARY KEY (`id`),
  ADD KEY `agent_id` (`agent_id`),
  ADD KEY `app_id` (`app_id`);

--
-- 表的索引 `agent_app_applications`
--
ALTER TABLE `agent_app_applications`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `agent_orders`
--
ALTER TABLE `agent_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `order_no` (`order_no`);

--
-- 表的索引 `agent_products`
--
ALTER TABLE `agent_products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `agent_id` (`agent_id`);

--
-- 表的索引 `agent_withdrawals`
--
ALTER TABLE `agent_withdrawals`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `announcements`
--
ALTER TABLE `announcements`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `announcement_reads`
--
ALTER TABLE `announcement_reads`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_read` (`announcement_id`,`user_id`);

--
-- 表的索引 `apps`
--
ALTER TABLE `apps`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `app_key` (`app_key`);

--
-- 表的索引 `balance_logs`
--
ALTER TABLE `balance_logs`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `card_codes`
--
ALTER TABLE `card_codes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `card_code` (`card_code`),
  ADD KEY `idx_card_code` (`card_code`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_used_by` (`used_by`);

--
-- 表的索引 `changelog`
--
ALTER TABLE `changelog`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `version` (`version`);

--
-- 表的索引 `downloads`
--
ALTER TABLE `downloads`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `email_log`
--
ALTER TABLE `email_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_to_email` (`to_email`),
  ADD KEY `idx_created` (`created_at`);

--
-- 表的索引 `email_templates`
--
ALTER TABLE `email_templates`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `type` (`type`),
  ADD KEY `idx_type` (`type`);

--
-- 表的索引 `email_verify_codes`
--
ALTER TABLE `email_verify_codes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_email` (`email`),
  ADD KEY `idx_code` (`code`),
  ADD KEY `idx_expired` (`expired_at`);

--
-- 表的索引 `encrypt_coupons`
--
ALTER TABLE `encrypt_coupons`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `code` (`code`);

--
-- 表的索引 `encrypt_coupon_usage`
--
ALTER TABLE `encrypt_coupon_usage`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user` (`user_id`),
  ADD KEY `idx_coupon` (`coupon_id`);

--
-- 表的索引 `encrypt_history`
--
ALTER TABLE `encrypt_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- 表的索引 `encrypt_packages`
--
ALTER TABLE `encrypt_packages`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `encrypt_services`
--
ALTER TABLE `encrypt_services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `idx_expire_date` (`expire_date`);

--
-- 表的索引 `invite_records`
--
ALTER TABLE `invite_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_inviter` (`inviter_id`),
  ADD KEY `idx_invitee` (`invitee_id`),
  ADD KEY `idx_code` (`invite_code`);

--
-- 表的索引 `licenses`
--
ALTER TABLE `licenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `license_code` (`license_code`);

--
-- 表的索引 `links`
--
ALTER TABLE `links`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `login_fail_log`
--
ALTER TABLE `login_fail_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_ip` (`ip`),
  ADD KEY `idx_lock_until` (`lock_until`);

--
-- 表的索引 `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `order_no` (`order_no`),
  ADD KEY `idx_expire_at` (`expire_at`);

--
-- 表的索引 `quick_login_config`
--
ALTER TABLE `quick_login_config`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `type` (`type`),
  ADD KEY `idx_enabled` (`enabled`);

--
-- 表的索引 `rebate_records`
--
ALTER TABLE `rebate_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user` (`user_id`),
  ADD KEY `idx_status` (`status`);

--
-- 表的索引 `site_config`
--
ALTER TABLE `site_config`
  ADD PRIMARY KEY (`key`);

--
-- 表的索引 `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `ticket_replies`
--
ALTER TABLE `ticket_replies`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `updates`
--
ALTER TABLE `updates`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `version` (`version`);

--
-- 表的索引 `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `idx_gitee_id` (`gitee_id`),
  ADD KEY `idx_union_id` (`union_id`),
  ADD KEY `idx_invite_code` (`invite_code`),
  ADD KEY `idx_feishu_id` (`feishu_id`);

--
-- 表的索引 `user_groups`
--
ALTER TABLE `user_groups`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `user_group_purchases`
--
ALTER TABLE `user_group_purchases`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `user_login_log`
--
ALTER TABLE `user_login_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_ip` (`ip`);

--
-- 表的索引 `user_oauth_bindings`
--
ALTER TABLE `user_oauth_bindings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_user_oauth` (`user_id`,`oauth_type`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_oauth` (`oauth_type`,`openid`);

--
-- 表的索引 `user_version_reminders`
--
ALTER TABLE `user_version_reminders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_user_version` (`user_id`,`version`);

--
-- 表的索引 `withdraw_records`
--
ALTER TABLE `withdraw_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user` (`user_id`),
  ADD KEY `idx_status` (`status`);

--
-- 在导出的表使用AUTO_INCREMENT
--

--
-- 使用表AUTO_INCREMENT `agent_applications`
--
ALTER TABLE `agent_applications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `agent_apps`
--
ALTER TABLE `agent_apps`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `agent_app_applications`
--
ALTER TABLE `agent_app_applications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `agent_orders`
--
ALTER TABLE `agent_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `agent_products`
--
ALTER TABLE `agent_products`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `agent_withdrawals`
--
ALTER TABLE `agent_withdrawals`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `announcements`
--
ALTER TABLE `announcements`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `announcement_reads`
--
ALTER TABLE `announcement_reads`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `apps`
--
ALTER TABLE `apps`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `balance_logs`
--
ALTER TABLE `balance_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `card_codes`
--
ALTER TABLE `card_codes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `changelog`
--
ALTER TABLE `changelog`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `downloads`
--
ALTER TABLE `downloads`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `email_log`
--
ALTER TABLE `email_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `email_templates`
--
ALTER TABLE `email_templates`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- 使用表AUTO_INCREMENT `email_verify_codes`
--
ALTER TABLE `email_verify_codes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `encrypt_coupons`
--
ALTER TABLE `encrypt_coupons`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `encrypt_coupon_usage`
--
ALTER TABLE `encrypt_coupon_usage`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `encrypt_history`
--
ALTER TABLE `encrypt_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `encrypt_packages`
--
ALTER TABLE `encrypt_packages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `encrypt_services`
--
ALTER TABLE `encrypt_services`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `invite_records`
--
ALTER TABLE `invite_records`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `licenses`
--
ALTER TABLE `licenses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `links`
--
ALTER TABLE `links`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- 使用表AUTO_INCREMENT `login_fail_log`
--
ALTER TABLE `login_fail_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `orders`
--
ALTER TABLE `orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `quick_login_config`
--
ALTER TABLE `quick_login_config`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `rebate_records`
--
ALTER TABLE `rebate_records`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `tickets`
--
ALTER TABLE `tickets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `ticket_replies`
--
ALTER TABLE `ticket_replies`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `updates`
--
ALTER TABLE `updates`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `user_groups`
--
ALTER TABLE `user_groups`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `user_group_purchases`
--
ALTER TABLE `user_group_purchases`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `user_login_log`
--
ALTER TABLE `user_login_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `user_oauth_bindings`
--
ALTER TABLE `user_oauth_bindings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `user_version_reminders`
--
ALTER TABLE `user_version_reminders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 使用表AUTO_INCREMENT `withdraw_records`
--
ALTER TABLE `withdraw_records`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 限制导出的表
--

--
-- 限制表 `encrypt_coupon_usage`
--
ALTER TABLE `encrypt_coupon_usage`
  ADD CONSTRAINT `encrypt_coupon_usage_ibfk_1` FOREIGN KEY (`coupon_id`) REFERENCES `encrypt_coupons` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
