fix(topup): settle recharge orders atomically

This commit is contained in:
CaIon
2026-08-11 22:03:47 +08:00
parent d7992672a6
commit 50e5377ea5
7 changed files with 367 additions and 82 deletions
+6
View File
@@ -146,3 +146,9 @@ func QuotaFromDecimalChecked(d decimal.Decimal) (int, *QuotaClamp) {
f, _ := d.Round(0).Float64()
return saturateQuota(f, "QuotaFromDecimal")
}
// QuotaFromDecimalStrict converts an in-range decimal quota and rejects a
// value that would otherwise be saturated at the database's int32 boundary.
func QuotaFromDecimalStrict(d decimal.Decimal) (int, error) {
return strictQuota(QuotaFromDecimalChecked(d))
}