增加订单实时状态同步

This commit is contained in:
yml2213
2026-08-17 14:51:51 +08:00
parent 5330b55b75
commit 18dad9b0fe
13 changed files with 798 additions and 16 deletions
@@ -12,6 +12,7 @@ import {
getWorkerPlatformNotificationConfig,
type WorkerPlatformNotificationEventKey,
} from '../worker-platform/worker-platform-notification-config-service.js'
import { publishRealtimeEvent } from '../realtime/realtime-event-service.js'
const ADMIN_WORKER_PLATFORM_PATH = '/admin/worker-platform'
@@ -116,6 +117,14 @@ export async function remindWorkerAcceptanceAdminNotification(workOrderId: numbe
cooldownMs: 30 * 60 * 1000,
})
}
if (notification?.visible) {
publishRealtimeEvent({
type: 'admin_notification.changed',
entityId: Number(notification.id),
scopes: ['admin_notifications'],
admin: true,
})
}
return notification
}
@@ -134,6 +143,12 @@ export async function resolveAdminNotificationEntity(
reason,
now: new Date().toISOString(),
})
publishRealtimeEvent({
type: 'admin_notification.changed',
entityId,
scopes: ['admin_notifications'],
admin: true,
})
}
export async function listAdminPendingNotifications(limit = 20) {
@@ -195,6 +210,14 @@ async function createConfiguredWorkerPlatformNotification(
cooldownKey: notification.dedupe_key,
})
}
if (notification?.visible) {
publishRealtimeEvent({
type: 'admin_notification.changed',
entityId: Number(notification.id),
scopes: ['admin_notifications'],
admin: true,
})
}
return notification
}