租期天数改为向上取整到整天

不足一天按一天计(如 1.3/1.7 均计 2 天),前后端展示与预计时长计算保持一致。
This commit is contained in:
yml2213
2026-07-20 22:14:03 +08:00
parent 4f979e1e29
commit 0ef6a481f5
3 changed files with 46 additions and 12 deletions
+5 -3
View File
@@ -63,10 +63,12 @@ func estimateOrderDurationHours(snapshot datatypes.JSON) int {
if days <= 0 {
return internalOrderHours
}
hours := int(math.Round(days * 24))
if hours <= 0 {
return internalOrderHours
// 不足整天按整天向上取整,例如 1.3 / 1.7 天均按 2 天计
daysCeil := int(math.Ceil(days))
if daysCeil < 1 {
daysCeil = 1
}
hours := daysCeil * 24
return hours
}