- 新增 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>
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
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
|
||
)
|