fix:合并

This commit is contained in:
momo
2023-09-15 17:58:45 +08:00
parent e4343eb2d6
commit ca7cf4c81e
14 changed files with 732 additions and 418 deletions

View File

@@ -1 +1,25 @@
package order
import (
"fusenapi/constants"
"fusenapi/model/gmodel"
"strconv"
)
func GetAmountCurrency(req *gmodel.AmountCurrency) (*float64, error) {
if req.CurrentCurrency == req.OriginalCurrency {
req.CurrentAmount = req.OriginalAmount
} else {
f1, err1 := strconv.ParseFloat(string(req.OriginalAmount), 64)
if err1 != nil {
return nil, err1
}
f2, err2 := strconv.ParseFloat(string(req.OriginalAmount), 64)
if err2 != nil {
return nil, err2
}
result := f1 * f2
req.CurrentAmount = constants.AmountUnit(strconv.FormatFloat(result, 'f', -1, 64))
}
return nil
}