f
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user