Files
junhong_cmp_fiber/pkg/constants/refund_post_process.go
邹进 8eb7d403c4 feat: 退款资产后处理逐次尝试记录与重试上限,停复机指令调用前结束写跳过记录
- 新增 tb_refund_post_process_attempt,每次尝试一条(步骤、触发方式、结果、错误码与信息、耗时)
- 退款单增加 asset_post_status/attempts/last_error/next_at;失败按 2^(n-1) 分钟退避(最长 1 小时),10 次后转人工
- 中间失败只写应用日志,成功或转人工写一条结论审计(带总尝试次数、首次失败时间、最后错误码)
- 补偿扫描跳过需人工处理与未到重试时间的退款单,Outbox 不再无限重投
- 新增 POST /refunds/:id/asset-post-processing/retry 人工重试
- 停复机指令执行前结束(已是目标状态、条件不再满足、需相反动作)写 skipped 停复机记录
- 迁移 000271 需维护者在测试库执行后再部署

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:33:32 +09:00

34 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package constants
import "time"
// 退款资产后处理步骤(tb_refund_post_process_attempt.step)。
const (
RefundPostStepLoad = "load" // 读取订单与资产
RefundPostStepInvalidate = "invalidate" // 套餐失效
RefundPostStepActivate = "activate" // 接续激活
RefundPostStepCheckMain = "check_main" // 查询生效主套餐
RefundPostStepStop = "stop" // 停机评估或停机
RefundPostStepMark = "mark" // 标记完成
RefundPostStepDone = "done" // 全部完成
)
// 退款资产后处理触发方式。
const (
RefundPostTriggerOutbox = "outbox" // Outbox 投递(含补偿扫描重投)
RefundPostTriggerManual = "manual" // 后台人工重试
)
// 退款资产后处理尝试结果。
const (
RefundPostResultSuccess = "success"
RefundPostResultFailed = "failed"
)
const (
// RefundPostMaxAttempts 是退款资产后处理自动重试上限,达到后转人工处理。
RefundPostMaxAttempts = 10
// RefundPostMaxBackoff 是自动重试间隔上限。
RefundPostMaxBackoff = time.Hour
)