mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
充值改为保留两位小数
This commit is contained in:
parent
5240971b4a
commit
79d7758617
@ -98,7 +98,7 @@ func RequestEpay(c *gin.Context) {
|
||||
topUp := &model.TopUp{
|
||||
UserId: id,
|
||||
Amount: req.Amount,
|
||||
Money: int(amount),
|
||||
Money: payMoney,
|
||||
TradeNo: "A" + tradeNo,
|
||||
CreateTime: time.Now().Unix(),
|
||||
Status: "pending",
|
||||
@ -175,5 +175,6 @@ func RequestAmount(c *gin.Context) {
|
||||
}
|
||||
id := c.GetInt("id")
|
||||
user, _ := model.GetUserById(id, false)
|
||||
c.JSON(200, gin.H{"message": "success", "data": GetAmount(float64(req.Amount), *user)})
|
||||
payMoney := GetAmount(float64(req.Amount), *user)
|
||||
c.JSON(200, gin.H{"message": "success", "data": strconv.FormatFloat(payMoney, 'f', 2, 64)})
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ type TopUp struct {
|
||||
Id int `json:"id"`
|
||||
UserId int `json:"user_id" gorm:"index"`
|
||||
Amount int `json:"amount"`
|
||||
Money int `json:"money"`
|
||||
Money float64 `json:"money"`
|
||||
TradeNo string `json:"trade_no"`
|
||||
CreateTime int64 `json:"create_time"`
|
||||
Status string `json:"status"`
|
||||
|
Loading…
Reference in New Issue
Block a user