fix(v2): 退款自愈扫描加回溯窗(防 LIMIT 尾部饥饿)+ 清死行

RefundApplyTask 的候选查询按 out_trade_no ASC/id ASC 取前 200,succeeded 退款历史
只增不减、partially_refunded 长期驻留,超过 limit 后最新的崩溃窗口永远排在候选外
扫不到。两路查询都加 since 回溯窗:RefundStore.ListDistinctOutTradeNosByStatusSince
(completed_at>=since)、OrderStore.ListOrdersByStatusSince(updated_at>=since),旧的
无窗方法原样保留。RefundApplyTask 新增 lookback/now 参数,config.ReconcileConfig 新增
RefundApplyLookbackMin(默认 48h)。顺带按 T6 复审补 OrderTTLMin 字段注释(须 ≫ crypto
orderTTL 15min),清 sync_test.go 死行 `_ = time.Second`。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
wangjia
2026-07-10 17:59:57 +08:00
parent 727ed74899
commit 9117de7dcf
9 changed files with 212 additions and 14 deletions
-1
View File
@@ -49,7 +49,6 @@ func TestSyncPendingTaskSettlesViaQuery(t *testing.T) {
if o.Status != model.OrderPaidV2 {
t.Fatalf("查单对账后应 paid, got %v", o.Status)
}
_ = time.Second
}
func TestPaidSpotCheckTaskRunsCleanOnConsistent(t *testing.T) {