fix(admin): floor batch deductions at zero

This commit is contained in:
RWDai
2026-09-28 17:56:27 +08:00
parent 390b73d4b6
commit 4c07d9fcfb
3 changed files with 23 additions and 11 deletions
@@ -226,7 +226,11 @@ impl AppState {
let before_gift = wallet.gift_balance;
let before_total = before_recharge + before_gift;
let amount_usd = if clamp_deduction_to_available_balance && amount_usd < 0.0 {
-(-amount_usd).min(before_total.max(0.0))
if before_total < 0.0 {
-before_total
} else {
-(-amount_usd).min(before_total)
}
} else {
amount_usd
};