refactor(money): 统一金额分为纯整数工具

This commit is contained in:
yml2213
2026-10-30 14:33:35 +08:00
parent 85bff95042
commit 37e1980d2d
7 changed files with 156 additions and 179 deletions
@@ -10,7 +10,6 @@ import (
"hfb_sys/backend/internal/model"
"hfb_sys/backend/internal/timeutil"
"hfb_sys/backend/pkg/money"
"gorm.io/gorm"
"gorm.io/gorm/clause"
@@ -264,10 +263,6 @@ func applyEntry(account *model.WalletAccount, entry Entry) (int64, error) {
}
}
func roundWalletMoney(yuan float64) float64 {
return money.Round(yuan)
}
func toAccountDTO(account model.WalletAccount) *AccountDTO {
return &AccountDTO{
UserID: account.UserID,
@@ -53,10 +53,6 @@ func TestApplyEntryKeepsWalletMoneyAtJiaoPrecision(t *testing.T) {
if account.AvailableBalanceCent != 230 {
t.Fatalf("AvailableBalanceCent = %d, want 230", account.AvailableBalanceCent)
}
if rounded := roundWalletMoney(2.36); rounded != 2.4 {
t.Fatalf("roundWalletMoney(2.36) = %v, want 2.4", rounded)
}
}
func TestNewLedgerNoUsesReadableFormat(t *testing.T) {