feat(fulfillment): 增加事务 Outbox 同步履约状态

- 用事务 Outbox 和签名 Webhook 替换直接状态回调
- 增加 Outbox 投递 worker、重试与低频对账兜底
- 缓存客户领取页绑定状态并补充签名与迁移测试
This commit is contained in:
yml
2026-11-18 11:00:28 +08:00
parent 54b9f3251d
commit 9b2fcf1d1f
23 changed files with 1324 additions and 130 deletions
@@ -188,6 +188,7 @@ export default function AdminLayout() {
void queryClient.invalidateQueries({ queryKey: ['admin-notifications'] })
void queryClient.invalidateQueries({ queryKey: ['admin-tasks'] })
void queryClient.invalidateQueries({ queryKey: ['admin-orders'] })
void queryClient.invalidateQueries({ queryKey: ['admin-douyu-fulfillment'] })
void queryClient.invalidateQueries({ queryKey: ['admin-dashboard-summary'] })
},
// 会话过期时清登录态回登录页,避免 SSE 带着失效 token 无限重连刷 401。
@@ -522,6 +523,10 @@ function applyAdminRealtimeEvent(
event: RealtimeEvent,
queryClient: ReturnType<typeof useQueryClient>,
) {
if (event.type === 'order.changed' && event.scopes.includes('admin_douyu_fulfillment')) {
void queryClient.invalidateQueries({ queryKey: ['admin-douyu-fulfillment'] })
}
if (event.type === 'admin_notification.changed' && isRecord(event.data)) {
queryClient.setQueryData(['admin-notifications'], (current: unknown) => {
if (!isRecord(current) || !isRecord(current.data)) return current