chore(v2): 终审收尾——settle-sync 非常态结果落日志 + Retry 补 body 上限
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
@@ -3,6 +3,7 @@ package gateway
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/wangjia/pay/internal/model"
|
||||
@@ -131,8 +132,14 @@ func (g *Gateway) SyncPendingAttempts(ctx context.Context, limit int) (int, erro
|
||||
if err != nil || ev == nil {
|
||||
continue
|
||||
}
|
||||
if res, _ := g.Settle(ctx, ev); res == SettleProcessed {
|
||||
res, serr := g.Settle(ctx, ev)
|
||||
switch res {
|
||||
case SettleProcessed:
|
||||
settled++
|
||||
case SettleIgnored, SettleDuplicate:
|
||||
// 常态:未付/已处理,不刷日志
|
||||
default: // not_found / amount_mismatch / failed —— 对账兜底的盲区,必须可见
|
||||
log.Printf("[settle-sync] attempt=%s channel=%s result=%s err=%v", att.ProviderRef, att.Channel, res, serr)
|
||||
}
|
||||
}
|
||||
return settled, nil
|
||||
|
||||
@@ -78,8 +78,12 @@ type retryRequest struct {
|
||||
|
||||
// Retry POST /api/v2/orders/:order_no/retry
|
||||
func (h *GatewayHandler) Retry(c *gin.Context) {
|
||||
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, maxOrderBodyBytes)
|
||||
var req retryRequest
|
||||
_ = c.ShouldBindJSON(&req)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
util.RespondError(c, http.StatusBadRequest, "bad_request", "参数格式错误")
|
||||
return
|
||||
}
|
||||
if req.Method == "" {
|
||||
util.RespondError(c, http.StatusBadRequest, "bad_request", "缺少 method")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user