fix(charge):修复用户充值记录创建的时候对于数值类型内容解析的问题。
This commit is contained in:
parent
33ccd7e0b6
commit
0c725e99a4
|
@ -50,11 +50,14 @@ func createNewUserChargeRecord(c *fiber.Ctx) error {
|
||||||
chargeLog.Error("无法解析创建充值记录的请求数据。", zap.Error(err))
|
chargeLog.Error("无法解析创建充值记录的请求数据。", zap.Error(err))
|
||||||
return result.Error(http.StatusBadRequest, err.Error())
|
return result.Error(http.StatusBadRequest, err.Error())
|
||||||
}
|
}
|
||||||
|
fee, _ := createionForm.Fee.Float64()
|
||||||
|
discount, _ := createionForm.Discount.Float64()
|
||||||
|
amount, _ := createionForm.Amount.Float64()
|
||||||
ok, err := service.ChargeService.RecordUserCharge(
|
ok, err := service.ChargeService.RecordUserCharge(
|
||||||
createionForm.UserId,
|
createionForm.UserId,
|
||||||
createionForm.Fee,
|
&fee,
|
||||||
createionForm.Discount,
|
&discount,
|
||||||
createionForm.Amount,
|
&amount,
|
||||||
createionForm.ChargeTo,
|
createionForm.ChargeTo,
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,6 +2,8 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"electricity_bill_calc/types"
|
"electricity_bill_calc/types"
|
||||||
|
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserChargeDetail struct {
|
type UserChargeDetail struct {
|
||||||
|
@ -22,9 +24,9 @@ type UserChargeDetail struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChargeRecordCreationForm struct {
|
type ChargeRecordCreationForm struct {
|
||||||
UserId string `json:"userId"`
|
UserId string `json:"userId"`
|
||||||
Fee *float64 `json:"fee"`
|
Fee *decimal.Decimal `json:"fee"`
|
||||||
Discount *float64 `json:"discount"`
|
Discount *decimal.Decimal `json:"discount"`
|
||||||
Amount *float64 `json:"amount"`
|
Amount *decimal.Decimal `json:"amount"`
|
||||||
ChargeTo types.Date `json:"chargeTo"`
|
ChargeTo types.Date `json:"chargeTo"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user