diff --git a/md/appreciation.go b/md/appreciation.go index cec3233..cb4794b 100644 --- a/md/appreciation.go +++ b/md/appreciation.go @@ -14,3 +14,8 @@ type DealWithdrawalAndDestroyResp struct { DestroyValue float64 `json:"destroy_value"` RefluxValue float64 `json:"reflux_value"` } +type DealWithdrawalFeeResp struct { + WithdrawalCommissionFee float64 `json:"withdrawal_commission_fee"` //提现手续费 + WithdrawalDestroyFee float64 `json:"withdrawal_destroy_fee"` //提现销毁增值积分比例 + WithdrawalRefluxFee float64 `json:"withdrawal_reflux_fee"` //提现回流增值积分比例 +} diff --git a/rule/appreciation.go b/rule/appreciation.go index 57344f6..34f3a5c 100644 --- a/rule/appreciation.go +++ b/rule/appreciation.go @@ -54,10 +54,10 @@ func DealTransferIn(session *xorm.Session, amount float64) (err error, value flo } // DealWithdrawalAndDestroy 处理给用户提现 -func DealWithdrawalAndDestroy(session *xorm.Session, transferOut float64) (err error, resp md.DealWithdrawalAndDestroyResp) { - transferOutValue := decimal.NewFromFloat(transferOut).Mul(md.WithdrawalCommissionFee) - destroyValue := decimal.NewFromFloat(transferOut).Mul(md.WithdrawalDestroyFee) - refluxValue := decimal.NewFromFloat(transferOut).Mul(md.WithdrawalRefluxFee) +func DealWithdrawalAndDestroy(session *xorm.Session, feeMap md.DealWithdrawalFeeResp, transferOut float64) (err error, resp md.DealWithdrawalAndDestroyResp) { + transferOutValue := decimal.NewFromFloat(transferOut).Mul(decimal.NewFromFloat(feeMap.WithdrawalCommissionFee)) + destroyValue := decimal.NewFromFloat(transferOut).Mul(decimal.NewFromFloat(feeMap.WithdrawalDestroyFee)) + refluxValue := decimal.NewFromFloat(transferOut).Mul(decimal.NewFromFloat(feeMap.WithdrawalRefluxFee)) err, nowValue := CalcAppreciationValue(session) if err != nil { return