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
@@ -8,7 +8,6 @@ import (
"strings"
"hfb_sys/backend/internal/model"
"hfb_sys/backend/pkg/money"
"gorm.io/datatypes"
)
@@ -462,7 +461,11 @@ func extractListingObjectKey(fileURL string) string {
return key
}
// roundMoney 使用统一的角精度(0.1元)
// roundMoney 是历史外部上传/审核链路的兼容实现,仍按 0.1 元精度工作。
// 卖家发布链路已改走整数分/基点计算,不再调用该函数。
func roundMoney(value float64) float64 {
return money.Round(value)
if value <= 0 || math.IsNaN(value) || math.IsInf(value, 0) {
return 0
}
return math.Round(value*10) / 10
}