mirror of
https://github.com/woodchen-ink/aimodels-prices.git
synced 2025-07-18 13:41:59 +08:00
优化价格计算精度,将价格除法结果的小数位数从2位调整为4位,以提高价格处理的准确性。
This commit is contained in:
parent
7963ac8294
commit
9b4cee8e0f
@ -51,12 +51,12 @@ func GetPriceRates(c *gin.Context) {
|
|||||||
|
|
||||||
if price.Currency == "USD" {
|
if price.Currency == "USD" {
|
||||||
// 如果是美元,除以2
|
// 如果是美元,除以2
|
||||||
inputRate = round(price.InputPrice/2, 2)
|
inputRate = round(price.InputPrice/2, 4)
|
||||||
outputRate = round(price.OutputPrice/2, 2)
|
outputRate = round(price.OutputPrice/2, 4)
|
||||||
} else {
|
} else {
|
||||||
// 如果是人民币或其他货币,除以14
|
// 如果是人民币或其他货币,除以14
|
||||||
inputRate = round(price.InputPrice/14, 2)
|
inputRate = round(price.InputPrice/14, 4)
|
||||||
outputRate = round(price.OutputPrice/14, 2)
|
outputRate = round(price.OutputPrice/14, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建当前价格的PriceRate
|
// 创建当前价格的PriceRate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user