diff --git a/internal/api/manage/withdrawals/query.go b/internal/api/manage/withdrawals/query.go index 88b6242..bd303cf 100755 --- a/internal/api/manage/withdrawals/query.go +++ b/internal/api/manage/withdrawals/query.go @@ -248,11 +248,12 @@ func QueryFail(c *gin.Context) { var array []user.Withdraw dbc.DB.Limit(10).Offset(p.Page*10).Order("created_at desc").Find(&array, where, p.MinMoney, p.MaxMoney, p.ID, p.Name) type moneyType struct { - Monet float32 `gorm:"column:all_amount"` + Monet float32 `gorm:"column:all_amount"` + ActualAmountCount decimal.Decimal `gorm:"column:actual_amount_count"` } - var moneyAll []moneyType - dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll) + var moneyAll moneyType + dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount, sum(actual_amount) as actual_amount_count").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll) for key, _info := range array { information := user.Information{} @@ -261,14 +262,11 @@ func QueryFail(c *gin.Context) { array[key].UserTrueNo = information.IDCard array[key].UserPhone = information.Mobile } - money := float32(0.0) - if len(moneyAll) > 0 { - money = moneyAll[0].Monet - } back.Suc(c, "", gin.H{ - "total": count, - "list": array, - "money": money, + "total": count, + "list": array, + "money": moneyAll.Monet, + "actualAmountCount": moneyAll.ActualAmountCount, }) }