mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-13 07:40:56 +00:00
refactor: deprecate int32 (#7025)
* refactor: deprecate int32 * fix(db): reject legacy user quota schemas at startup * fix(quota): enforce wallet bounds and saturating billing conversions * fix(rate-limit): keep count*duration from wrapping int64 * fix: error message
This commit is contained in:
@@ -88,15 +88,14 @@ func calcViolationFeeQuota(amount, groupRatio float64) int {
|
||||
if groupRatio <= 0 {
|
||||
return 0
|
||||
}
|
||||
quota := decimal.NewFromFloat(amount).
|
||||
quota := common.QuotaFromDecimal(decimal.NewFromFloat(amount).
|
||||
Mul(decimal.NewFromFloat(common.QuotaPerUnit)).
|
||||
Mul(decimal.NewFromFloat(groupRatio)).
|
||||
Round(0).
|
||||
IntPart()
|
||||
Round(0))
|
||||
if quota <= 0 {
|
||||
return 0
|
||||
}
|
||||
return int(quota)
|
||||
return quota
|
||||
}
|
||||
|
||||
// ChargeViolationFeeIfNeeded charges an additional fee after the normal flow finishes (including refund).
|
||||
|
||||
Reference in New Issue
Block a user