This commit is contained in:
2026-02-01 18:08:11 +08:00
parent 1217ba119b
commit f31c2d7293

View File

@@ -3,6 +3,7 @@ package admin_agent
import (
"context"
"database/sql"
"math"
"time"
"tyass-server/app/main/model"
"tyass-server/common/xerr"
@@ -128,8 +129,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