作者 陈志颖

fix:兑换素币清单返回精度

... ... @@ -2486,6 +2486,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
personSaved.ExchangedCash, _ = decimal.NewFromFloatWithExponent(personSaved.ExchangedCash, -2).Float64()
personSaved.ExchangedSuMoney, _ = decimal.NewFromFloatWithExponent(personSaved.ExchangedSuMoney, -2).Float64()
return personSaved, nil
}
... ... @@ -2527,6 +2529,8 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
personFound.ExchangedCash, _ = decimal.NewFromFloatWithExponent(personFound.ExchangedCash, -2).Float64()
personFound.ExchangedSuMoney, _ = decimal.NewFromFloatWithExponent(personFound.ExchangedSuMoney, -2).Float64()
return personFound, nil
}
}
... ... @@ -2593,7 +2597,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
for i, _ := range people {
people[i].ExchangedSuMoney, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedSuMoney, -2).Float64()
people[i].ExchangedCash, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedCash, -2).Float64()
}
return map[string]interface{}{
"count": count,
"people": people,
... ... @@ -2608,6 +2615,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
for i, _ := range people {
people[i].ExchangedSuMoney, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedSuMoney, -2).Float64()
people[i].ExchangedCash, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedCash, -2).Float64()
}
return map[string]interface{}{
"count": count,
"people": people,
... ... @@ -2894,6 +2905,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashPersonById(exportExchang
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
for i, _ := range people {
people[i].ExchangedSuMoney, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedSuMoney, -2).Float64()
people[i].ExchangedCash, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedCash, -2).Float64()
}
return people, nil
}
}
... ...