This commit is contained in:
liangzai
2026-02-01 17:35:35 +08:00
parent bcbecc402d
commit a4f8e17f32

View File

@@ -3,6 +3,7 @@ package admin_agent
import (
"context"
"database/sql"
"math"
"time"
"tyc-server/app/main/model"
"tyc-server/common/xerr"
@@ -129,8 +130,9 @@ func (l *AdminReviewBankCardWithdrawalLogic) approveWithdrawal(ctx context.Conte
// applyReviewTaxRate 按审核时选择的扣税比例更新提现记录与扣税记录
func (l *AdminReviewBankCardWithdrawalLogic) applyReviewTaxRate(ctx context.Context, session sqlx.Session, record *model.AgentWithdrawal, taxRate float64) error {
newTaxAmount := record.Amount * taxRate
newActualAmount := record.Amount - newTaxAmount
// 金额保留两位小数,避免浮点误差并与前端/支付宝一致
newTaxAmount := math.Round(record.Amount*taxRate*100) / 100
newActualAmount := math.Round((record.Amount-newTaxAmount)*100) / 100
record.TaxAmount = newTaxAmount
record.ActualAmount = newActualAmount