fix:合并
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user