-- 插入站点与运营配置 -- 一、站点信息 INSERT INTO settings (key, value, value_type, description, category, is_system, is_editable) VALUES -- 站点基本信息 ('site.name', 'MMAP System', 'string', '站点名称', 'site', true, true), ('site.locale_default', 'zh-CN', 'string', '默认语言', 'site', true, true), ('site.locales_supported', '["zh-CN", "en"]', 'json', '支持的语言列表', 'site', true, true), -- 品牌配置 ('site.brand.logo_url', '/images/logo.png', 'string', 'Logo URL', 'site', true, true), ('site.brand.primary_color', '#3B82F6', 'string', '主题色', 'site', true, true), ('site.brand.dark_mode_default', 'false', 'boolean', '暗黑模式默认开启', 'site', true, true), -- 页脚链接 ('site.footer_links', '[ {"name": "关于我们", "url": "/about", "visible_to_guest": true}, {"name": "联系我们", "url": "/contact", "visible_to_guest": true}, {"name": "用户中心", "url": "/dashboard", "visible_to_guest": false} ]', 'json', '页脚链接配置', 'site', true, true) ON CONFLICT (key) DO NOTHING; -- 二、公告/维护配置 INSERT INTO settings (key, value, value_type, description, category, is_system, is_editable) VALUES -- 横幅公告 ('notice.banner.enabled', 'false', 'boolean', '横幅公告开关', 'notice', true, true), ('notice.banner.text', '{"zh-CN": "欢迎使用MMAP系统", "en": "Welcome to MMAP System"}', 'json', '横幅公告多语言文本', 'notice', true, true), -- 维护窗口 ('maintenance.window', '{ "enabled": false, "start_time": "2024-01-01T02:00:00Z", "end_time": "2024-01-01T06:00:00Z", "message": {"zh-CN": "系统维护中,请稍后再试", "en": "System maintenance in progress"} }', 'json', '维护窗口配置', 'maintenance', true, true), -- 弹窗公告 ('modal.announcements', '[ { "id": "welcome_2024", "title": {"zh-CN": "2024新年快乐", "en": "Happy New Year 2024"}, "content": {"zh-CN": "感谢您在过去一年的支持", "en": "Thank you for your support in the past year"}, "start_time": "2024-01-01T00:00:00Z", "end_time": "2024-01-31T23:59:59Z", "audience": ["all"], "priority": "high" } ]', 'json', '弹窗公告列表', 'notice', true, true) ON CONFLICT (key) DO NOTHING; -- 三、文档/帮助配置 INSERT INTO settings (key, value, value_type, description, category, is_system, is_editable) VALUES -- 文档链接 ('docs.links', '[ {"name": "API文档", "url": "/docs/api", "description": "完整的API接口文档"}, {"name": "图例说明", "url": "/docs/legend", "description": "系统图例和符号说明"}, {"name": "计费说明", "url": "/docs/billing", "description": "详细的计费规则和说明"}, {"name": "用户手册", "url": "/docs/user-guide", "description": "用户操作指南"} ]', 'json', '文档链接配置', 'docs', true, true), -- 支持渠道 ('support.channels', '{ "email": "support@mapp.com", "ticket_system": "/support/tickets", "chat_groups": [ {"name": "官方QQ群", "url": "https://qm.qq.com/xxx", "description": "技术交流群"}, {"name": "微信群", "qr_code": "/images/wechat-qr.png", "description": "扫码加入微信群"} ], "working_hours": {"zh-CN": "周一至周五 9:00-18:00", "en": "Mon-Fri 9:00-18:00"} }', 'json', '支持渠道配置', 'support', true, true) ON CONFLICT (key) DO NOTHING; -- 四、运营配置 INSERT INTO settings (key, value, value_type, description, category, is_system, is_editable) VALUES -- 功能开关 ('ops.features.registration_enabled', 'true', 'boolean', '用户注册功能开关', 'ops', true, true), ('ops.features.invite_code_required', 'true', 'boolean', '注册是否需要邀请码', 'ops', true, true), ('ops.features.email_verification', 'false', 'boolean', '邮箱验证功能开关', 'ops', true, true), -- 限制配置 ('ops.limits.max_users', '1000', 'number', '最大用户数限制', 'ops', true, true), ('ops.limits.max_invite_codes_per_user', '10', 'number', '每个用户最大邀请码数量', 'ops', true, true), ('ops.limits.session_timeout_hours', '24', 'number', '会话超时时间(小时)', 'ops', true, true), -- 通知配置 ('ops.notifications.welcome_email', 'true', 'boolean', '发送欢迎邮件', 'ops', true, true), ('ops.notifications.system_announcements', 'true', 'boolean', '系统公告通知', 'ops', true, true), ('ops.notifications.maintenance_alerts', 'true', 'boolean', '维护提醒通知', 'ops', true, true) ON CONFLICT (key) DO NOTHING; -- 创建配置分类页面 INSERT INTO pages (id, title, slug, description, is_active, created_at, updated_at) VALUES (gen_random_uuid(), '站点配置', 'site-settings', '站点基本信息、品牌、页脚等配置管理', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), '公告维护', 'notice-maintenance', '横幅公告、维护窗口、弹窗公告等配置管理', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), '文档支持', 'docs-support', '文档链接、支持渠道等配置管理', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), '运营配置', 'ops-settings', '功能开关、限制配置、通知配置等管理', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) ON CONFLICT (slug) DO NOTHING; -- 为每个页面创建配置块 INSERT INTO page_blocks (id, page_id, block_order, title, block_type, content, is_active, created_at, updated_at) VALUES -- 站点配置页面 (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'site-settings'), 1, '站点基本信息', 'settings', '{"category": "site", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'site-settings'), 2, '品牌配置', 'settings', '{"category": "site", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- 公告维护页面 (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'notice-maintenance'), 1, '横幅公告', 'settings', '{"category": "notice", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'notice-maintenance'), 2, '维护窗口', 'settings', '{"category": "maintenance", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'notice-maintenance'), 3, '弹窗公告', 'settings', '{"category": "notice", "editable": true, "display_mode": "table"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- 文档支持页面 (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'docs-support'), 1, '文档链接', 'settings', '{"category": "docs", "editable": true, "display_mode": "table"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'docs-support'), 2, '支持渠道', 'settings', '{"category": "support", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- 运营配置页面 (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'ops-settings'), 1, '功能开关', 'settings', '{"category": "ops", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'ops-settings'), 2, '限制配置', 'settings', '{"category": "ops", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (gen_random_uuid(), (SELECT id FROM pages WHERE slug = 'ops-settings'), 3, '通知配置', 'settings', '{"category": "ops", "editable": true, "display_mode": "form"}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) ON CONFLICT DO NOTHING;