新增系统配置页(运营管理系统后台)
This commit is contained in:
79
backend/database/config_init.sql
Normal file
79
backend/database/config_init.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- ============================================
|
||||
-- 梦幻西游一站式运营管理平台 - 系统配置表初始化脚本
|
||||
-- MySQL 8.4 兼容版本
|
||||
-- 创建日期: 2026-01-05
|
||||
-- ============================================
|
||||
|
||||
-- 使用数据库
|
||||
USE mhxy_web_vue;
|
||||
|
||||
-- 设置字符集
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ============================================
|
||||
-- 表: configs (系统配置表)
|
||||
-- ============================================
|
||||
DROP TABLE IF EXISTS `configs`;
|
||||
CREATE TABLE `configs` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`config_key` VARCHAR(100) NOT NULL COMMENT '配置键',
|
||||
`config_value` TEXT NOT NULL COMMENT '配置值',
|
||||
`config_type` VARCHAR(50) NOT NULL COMMENT '配置类型 (basic:基础配置, security:安全配置, game:游戏配置, payment:充值配置, email:邮件配置)',
|
||||
`description` VARCHAR(255) NULL COMMENT '配置描述',
|
||||
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `idx_config_key` (`config_key`),
|
||||
INDEX `idx_config_type` (`config_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统配置表';
|
||||
|
||||
-- ============================================
|
||||
-- 插入默认配置数据
|
||||
-- ============================================
|
||||
|
||||
-- 基础配置
|
||||
INSERT INTO `configs` (`config_key`, `config_value`, `config_type`, `description`) VALUES
|
||||
('backend_host', '127.0.0.1', 'basic', '后端IP或域名地址'),
|
||||
('backend_port', '3000', 'basic', '后端端口'),
|
||||
('log_level', 'info', 'basic', '日志级别 (info/debug/error)'),
|
||||
('login_captcha_enabled', 'true', 'basic', '登录验证码开关 (true:开启, false:关闭)'),
|
||||
('player_service_enabled', 'true', 'basic', '玩家服务中心开关 (true:开启, false:关闭)'),
|
||||
('player_service_close_msg', '玩家服务中心系统维护中', 'basic', '玩家服务中心关闭提示文本');
|
||||
|
||||
-- 安全配置
|
||||
INSERT INTO `configs` (`config_key`, `config_value`, `config_type`, `description`) VALUES
|
||||
('cors_origin', 'http://localhost:5173', 'security', '跨域地址'),
|
||||
('jwt_secret', 'your-secret-key-change-in-production', 'security', 'JWT密钥'),
|
||||
('jwt_expires_in', '2h', 'security', 'JWT有效期 (如: 2h, 7d, 30m)');
|
||||
|
||||
-- 游戏配置
|
||||
INSERT INTO `configs` (`config_key`, `config_value`, `config_type`, `description`) VALUES
|
||||
('game_server_proxy_url', 'http://127.0.0.1:8080/tool/http', 'game', '游戏服务端代理地址'),
|
||||
('game_server_psk', 'THIS_IS_A_32_BYTE_FIXED_PSK!!!!', 'game', '游戏服务端PSK密钥');
|
||||
|
||||
-- 邮件配置
|
||||
INSERT INTO `configs` (`config_key`, `config_value`, `config_type`, `description`) VALUES
|
||||
('mail_from', '', 'email', '发件人邮箱'),
|
||||
('mail_smtp_host', '', 'email', 'SMTP服务器地址'),
|
||||
('mail_smtp_port', '587', 'email', 'SMTP服务器端口'),
|
||||
('mail_smtp_user', '', 'email', 'SMTP用户名'),
|
||||
('mail_smtp_password', '', 'email', 'SMTP密码');
|
||||
|
||||
-- ============================================
|
||||
-- 验证数据
|
||||
-- ============================================
|
||||
SELECT
|
||||
id,
|
||||
config_key,
|
||||
config_value,
|
||||
config_type,
|
||||
description,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM configs
|
||||
ORDER BY config_type, id;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
-- 初始化完成
|
||||
Reference in New Issue
Block a user