feat(scheduler): 财务管道自动注册、水位记录与后台状态页

- 老配置读取时自动补齐六个管道任务,升级后无需手工添加
- 每个管道运行后写水位与 last_success_at,失败写 last_error
- 新增 GET /admin/fulfillment/pipeline/status 与单步重跑
- 后台「履约渠道 → 管道状态」展示启停、水位、最近执行与错误
- 定时任务管理接口不再丢弃管道自己的 config 字段
This commit is contained in:
yml2213
2026-10-31 19:13:38 +08:00
parent 2ba2656d58
commit 808949f3b8
7 changed files with 336 additions and 2 deletions
@@ -51,6 +51,25 @@ export type ChannelExceptionListResult = {
export type PipelineRunResult = Record<string, unknown>
export type FinancePipelineStatus = {
pipeline: string
label: string
lastItemId: number
lastStatDate: string | null
lastSuccessAt: string | null
lastError: string
jobId: string
scheduler: {
running: boolean
enabled: boolean
lastRunAt: string
lastFinishedAt: string
nextRunAt: string
lastStatus: string
lastMessage: string
} | null
}
export function fetchPendingChannelGroups(
params: {
page?: number
@@ -112,7 +131,11 @@ export function deleteChannelRule(ruleId: number) {
return apiDelete<{ deleted: boolean }>(`/api/v1/admin/fulfillment/rules/${ruleId}`)
}
export function runFinancePipeline(payload: { days?: number } = {}) {
export function fetchPipelineStatus() {
return apiGet<FinancePipelineStatus[]>('/api/v1/admin/fulfillment/pipeline/status')
}
export function runFinancePipeline(payload: { days?: number; pipeline?: string } = {}) {
return apiPost<PipelineRunResult>('/api/v1/admin/fulfillment/pipeline/run', payload, {
timeout: 300_000,
})