refactor(money): 统一金额分为纯整数工具
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user