修复:优化创建交易流程代码,将金额修改为保留3位小数点

This commit is contained in:
Ashang
2022-04-04 16:18:31 +08:00
parent 20c576b9bc
commit 68f92dd1b1
10 changed files with 144 additions and 168 deletions
+16
View File
@@ -0,0 +1,16 @@
package math
import (
"fmt"
"strconv"
)
// MustParsePrecFloat64 按小数位截取float
func MustParsePrecFloat64(value float64, prec int) float64 {
format := fmt.Sprintf("%%.%df", prec)
v, err := strconv.ParseFloat(fmt.Sprintf(format, value), 64)
if err != nil {
return 0
}
return v
}