增加订单实时状态同步
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user