完善接单平台通知配置

This commit is contained in:
yml2213
2026-08-17 13:54:01 +08:00
parent bca2e4a801
commit 5330b55b75
27 changed files with 1390 additions and 10 deletions
@@ -0,0 +1,29 @@
-- 后台待办通知:业务状态驱动,多个后台账号共享处理状态。
CREATE TABLE IF NOT EXISTS admin_notifications (
id BIGSERIAL PRIMARY KEY,
notification_type TEXT NOT NULL,
priority TEXT NOT NULL DEFAULT 'normal',
entity_type TEXT NOT NULL,
entity_id BIGINT NOT NULL,
dedupe_key TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
body TEXT NOT NULL DEFAULT '',
action_path TEXT NOT NULL DEFAULT '',
payload_json JSONB NOT NULL DEFAULT '{}'::jsonb,
reminder_count INTEGER NOT NULL DEFAULT 0,
last_reminded_at TIMESTAMPTZ,
status TEXT NOT NULL DEFAULT 'pending',
resolved_at TIMESTAMPTZ,
resolution_reason TEXT NOT NULL DEFAULT '',
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_admin_notifications_pending
ON admin_notifications (status, priority, updated_at DESC);
CREATE INDEX IF NOT EXISTS idx_admin_notifications_entity
ON admin_notifications (entity_type, entity_id);
COMMENT ON TABLE admin_notifications IS '后台共享业务待办通知,不使用个人已读状态';
COMMENT ON COLUMN admin_notifications.dedupe_key IS '同一业务待办的唯一标识';
@@ -0,0 +1,13 @@
-- 隐藏待办用于保留业务催办状态,不展示在后台铃铛中。
ALTER TABLE admin_notifications
ADD COLUMN IF NOT EXISTS visible BOOLEAN NOT NULL DEFAULT TRUE;
-- 每条待办保存创建或更新当时的声音开关,配置调整不影响历史待办。
ALTER TABLE admin_notifications
ADD COLUMN IF NOT EXISTS sound_enabled BOOLEAN NOT NULL DEFAULT TRUE;
CREATE INDEX IF NOT EXISTS idx_admin_notifications_visible_pending
ON admin_notifications (visible, status, priority, updated_at DESC);
COMMENT ON COLUMN admin_notifications.visible IS '是否展示在后台待办铃铛中';
COMMENT ON COLUMN admin_notifications.sound_enabled IS '该次待办更新是否允许浏览器声音播报';