Files
urbanLifeline/urbanLifelineServ/.bin/database/postgres/sql/initDataMessage.sql
2025-12-02 14:59:34 +08:00

119 lines
4.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 初始化消息渠道配置(与 message schema 对应)
-- 配置常用消息发送渠道
-- =============================
-- 1. 初始化消息渠道
-- =============================
INSERT INTO message.tb_message_channel (
optsn, channel_id, channel_code, channel_name, channel_desc,
config, status, priority, creator, create_time, deleted
) VALUES
-- 应用内消息(默认渠道,优先级最高)
('CH-0001', 'channel_app', 'app', '应用内消息', '系统内部消息通知',
'{"enabled": true, "realtime": true}'::json,
'enabled', 100, 'system', now(), false),
-- 短信通知
('CH-0002', 'channel_sms', 'sms', '短信通知', '短信发送服务',
'{
"enabled": false,
"provider": "",
"apiKey": "",
"apiSecret": "",
"signName": "",
"templateCode": ""
}'::json,
'disabled', 80, 'system', now(), false),
-- 邮件通知
('CH-0003', 'channel_email', 'email', '邮件通知', '电子邮件发送服务',
'{
"enabled": false,
"smtpHost": "",
"smtpPort": 465,
"username": "",
"password": "",
"fromAddress": "",
"useSsl": true
}'::json,
'disabled', 70, 'system', now(), false),
-- 微信公众号
('CH-0004', 'channel_wechat_mp', 'wechat_official_account', '微信公众号', '微信公众号模板消息',
'{
"enabled": false,
"appId": "",
"appSecret": "",
"templateId": ""
}'::json,
'disabled', 60, 'system', now(), false),
-- 微信小程序
('CH-0005', 'channel_wechat_mini', 'wechat_applet', '微信小程序', '微信小程序订阅消息',
'{
"enabled": false,
"appId": "",
"appSecret": "",
"templateId": ""
}'::json,
'disabled', 50, 'system', now(), false),
-- 钉钉通知
('CH-0006', 'channel_dingtalk', 'dingtalk', '钉钉通知', '钉钉工作通知',
'{
"enabled": false,
"agentId": "",
"appKey": "",
"appSecret": "",
"robotToken": ""
}'::json,
'disabled', 40, 'system', now(), false);
-- =============================
-- 2. 初始化消息模板(系统通用模板)
-- =============================
INSERT INTO message.tb_message_template (
optsn, template_id, template_code, template_name, template_type,
title_template, content_template, variables, service_type,
creator, create_time, deleted
) VALUES
-- 用户注册欢迎消息
('TPL-0001', 'tpl_user_welcome', 'USER_WELCOME', '用户注册欢迎', 'system',
'欢迎加入 {{platformName}}',
'您好,{{username}}\n\n欢迎加入 {{platformName}} 平台。您的账号已成功创建。\n\n账号信息\n- 用户名:{{usercode}}\n- 邮箱:{{email}}\n- 注册时间:{{registerTime}}\n\n祝您使用愉快',
'["platformName", "username", "usercode", "email", "registerTime"]'::jsonb,
'system',
'system', now(), false),
-- 密码重置通知
('TPL-0002', 'tpl_password_reset', 'PASSWORD_RESET', '密码重置通知', 'system',
'密码重置验证码',
'您好,{{username}}\n\n您正在重置密码验证码为{{code}}\n\n验证码有效期为 {{expireMinutes}} 分钟,请尽快完成操作。\n\n如非本人操作请忽略此消息。',
'["username", "code", "expireMinutes"]'::jsonb,
'system',
'system', now(), false),
-- 系统维护通知
('TPL-0003', 'tpl_system_maintenance', 'SYSTEM_MAINTENANCE', '系统维护通知', 'system',
'系统维护通知',
'尊敬的用户:\n\n系统将于 {{startTime}} 至 {{endTime}} 进行维护升级。\n\n维护内容{{content}}\n\n维护期间系统将暂停服务请您提前做好相关安排。\n\n给您带来不便敬请谅解',
'["startTime", "endTime", "content"]'::jsonb,
'system',
'system', now(), false),
-- 工单创建通知
('TPL-0101', 'tpl_ticket_created', 'TICKET_CREATED', '工单创建通知', 'business',
'新工单通知',
'您好,{{username}}\n\n您有一条新的工单需要处理\n\n工单编号{{ticketNo}}\n工单标题{{title}}\n优先级{{priority}}\n创建时间{{createTime}}\n\n请及时登录系统查看处理。',
'["username", "ticketNo", "title", "priority", "createTime"]'::jsonb,
'customer_service',
'system', now(), false),
-- 招标公告发布通知
('TPL-0201', 'tpl_bidding_published', 'BIDDING_PUBLISHED', '招标公告发布', 'business',
'招标公告发布通知',
'您好!\n\n新的招标项目已发布\n\n项目名称{{projectName}}\n项目编号{{projectNo}}\n发布时间{{publishTime}}\n截止时间{{deadlineTime}}\n\n详情请登录系统查看。',
'["projectName", "projectNo", "publishTime", "deadlineTime"]'::jsonb,
'bidding',
'system', now(), false);