f
This commit is contained in:
@@ -3,6 +3,7 @@ package admin_agent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"math"
|
||||||
"time"
|
"time"
|
||||||
"tyass-server/app/main/model"
|
"tyass-server/app/main/model"
|
||||||
"tyass-server/common/xerr"
|
"tyass-server/common/xerr"
|
||||||
@@ -128,8 +129,9 @@ func (l *AdminReviewBankCardWithdrawalLogic) approveWithdrawal(ctx context.Conte
|
|||||||
|
|
||||||
// applyReviewTaxRate 按审核时选择的扣税比例更新提现记录与扣税记录
|
// applyReviewTaxRate 按审核时选择的扣税比例更新提现记录与扣税记录
|
||||||
func (l *AdminReviewBankCardWithdrawalLogic) applyReviewTaxRate(ctx context.Context, session sqlx.Session, record *model.AgentWithdrawal, taxRate float64) error {
|
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.TaxAmount = newTaxAmount
|
||||||
record.ActualAmount = newActualAmount
|
record.ActualAmount = newActualAmount
|
||||||
|
|||||||
Reference in New Issue
Block a user