fix(server/pay): 订单展示金额兜底 — 老单 amount_minor=0 回退档位展示价(按方式结算币种)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
wangjia
2026-07-12 06:54:18 +08:00
parent ff91be928a
commit b30f472d90
2 changed files with 40 additions and 0 deletions
+8
View File
@@ -165,6 +165,14 @@ func orderViewFromRow(row *PurchaseRow) orderView {
}
if it, ok := CatalogBySKU(row.SKU); ok {
v.Plan, v.Days = it.Plan, it.Days
// 展示金额兜底:老单/webhook 前 amount_minor=0(旧下单不落金额)→ 按档位+
// 支付方式的结算币种回退到展示价,列表/详情不再显 0。webhook 到账后为实际金额,不触发。
if v.AmountMinor == 0 {
v.AmountMinor = DisplayAmountMinor(it, row.Method)
if v.Currency == "" {
v.Currency = SettlementCurrency(row.Method)
}
}
}
if row.PaidAt.Valid {
s := row.PaidAt.Time.UTC().Format(time.RFC3339)