fix:订单模块修改数字金额
This commit is contained in:
@@ -90,34 +90,50 @@ type GetAmountCurrencyUSDReq struct {
|
||||
}
|
||||
|
||||
// 处理金额(元)
|
||||
func GetAmountCurrencyFormat(req *gmodel.AmountCurrency) (res gmodel.AmountCurrency) {
|
||||
func GetAmountCurrencyFormat(req *gmodel.AmountCurrency, withThousandthPercentile bool) (res gmodel.AmountCurrency) {
|
||||
var currentAmount = format.CentitoDollarStr(req.CurrentAmount.(float64))
|
||||
if withThousandthPercentile {
|
||||
currentAmount = format.NumToStringWithThousandthPercentile(currentAmount)
|
||||
}
|
||||
|
||||
var originalAmount = format.CentitoDollarStr(req.OriginalAmount.(float64))
|
||||
if withThousandthPercentile {
|
||||
originalAmount = format.NumToStringWithThousandthPercentile(originalAmount)
|
||||
}
|
||||
|
||||
return gmodel.AmountCurrency{
|
||||
ExchangeRate: format.CentitoDollarStr(req.ExchangeRate.(float64)),
|
||||
CurrentAmount: format.CentitoDollarStr(req.CurrentAmount.(float64)),
|
||||
OriginalAmount: format.CentitoDollarStr(req.OriginalAmount.(float64)),
|
||||
ExchangeRate: req.ExchangeRate.(float64),
|
||||
CurrentAmount: currentAmount,
|
||||
OriginalAmount: originalAmount,
|
||||
CurrentCurrency: req.CurrentCurrency,
|
||||
OriginalCurrency: req.OriginalCurrency,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理金额(元)
|
||||
func GetAmountInfoFormat(req *gmodel.AmountInfo) gmodel.AmountInfo {
|
||||
Current := GetAmountCurrencyFormat(&req.Current)
|
||||
fmt.Println(Current)
|
||||
func GetAmountInfoFormat(req *gmodel.AmountInfo, withThousandthPercentile bool) gmodel.AmountInfo {
|
||||
return gmodel.AmountInfo{
|
||||
Change: GetAmountCurrencyFormat(&req.Change),
|
||||
Change: GetAmountCurrencyFormat(&req.Change, withThousandthPercentile),
|
||||
ChangeRemark: req.ChangeRemark,
|
||||
Current: GetAmountCurrencyFormat(&req.Current),
|
||||
Initiate: GetAmountCurrencyFormat(&req.Initiate),
|
||||
Current: GetAmountCurrencyFormat(&req.Current, withThousandthPercentile),
|
||||
Initiate: GetAmountCurrencyFormat(&req.Initiate, withThousandthPercentile),
|
||||
Metadata: req.Metadata,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理商品数量
|
||||
func GetPurchaseQuantity(req *gmodel.PurchaseQuantity) gmodel.PurchaseQuantity {
|
||||
func GetPurchaseQuantity(req *gmodel.PurchaseQuantity, withThousandthPercentile bool) gmodel.PurchaseQuantity {
|
||||
var initiate = strconv.FormatInt(int64(req.Initiate.(float64)), 10)
|
||||
if withThousandthPercentile {
|
||||
initiate = format.NumToStringWithThousandthPercentile(initiate)
|
||||
}
|
||||
var current = strconv.FormatInt(int64(req.Current.(float64)), 10)
|
||||
if withThousandthPercentile {
|
||||
current = format.NumToStringWithThousandthPercentile(current)
|
||||
}
|
||||
return gmodel.PurchaseQuantity{
|
||||
Initiate: strconv.FormatInt(int64(req.Initiate.(float64)), 10),
|
||||
Current: strconv.FormatInt(int64(req.Current.(float64)), 10),
|
||||
Initiate: initiate,
|
||||
Current: current,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user