|
|
|
@@ -177,15 +177,14 @@ func formatDiscount(ratio float64) string { |
|
|
|
if ratio <= 0 { |
|
|
|
return "免费" |
|
|
|
} |
|
|
|
discount := int(math.Round(ratio * 10)) |
|
|
|
if discount >= 10 { |
|
|
|
rawDiscount := math.Round(ratio*100) / 10 |
|
|
|
if rawDiscount >= 10 { |
|
|
|
return "" |
|
|
|
} |
|
|
|
remainder := int(math.Round(ratio*100)) % 10 |
|
|
|
if remainder == 0 { |
|
|
|
return fmt.Sprintf("%d折", discount) |
|
|
|
if rawDiscount == math.Trunc(rawDiscount) { |
|
|
|
return fmt.Sprintf("%.0f折", rawDiscount) |
|
|
|
} |
|
|
|
return fmt.Sprintf("%.1f折", ratio*10) |
|
|
|
return fmt.Sprintf("%.1f折", rawDiscount) |
|
|
|
} |
|
|
|
|
|
|
|
func ResetModelRatio(c *gin.Context) { |
|
|
|
|