[Snow Team] backend-fixer: auto-commit work

This commit is contained in:
yml
2026-06-09 17:04:40 +08:00
parent f5b38ff772
commit 62b898d7cc
11 changed files with 291 additions and 214 deletions
+18 -9
View File
@@ -345,11 +345,20 @@ type arbitrationSettlement struct {
}
func buildArbitrationSettlement(order model.RentalOrder, req ArbitrateRequest, renterFrozenBalance float64) (arbitrationSettlement, error) {
total := roundMoney(order.RentAmount + order.DepositAmount)
ownerRentAmount := roundMoney(order.OwnerRentAmount)
if ownerRentAmount <= 0 || ownerRentAmount > order.RentAmount {
ownerRentAmount = roundMoney(order.RentAmount)
rentAmount := float64(order.RentAmountCent) / 100
if rentAmount <= 0 {
rentAmount = order.RentAmount
}
depositAmount := float64(order.DepositAmountCent) / 100
if depositAmount <= 0 {
depositAmount = order.DepositAmount
}
ownerRentAmount := float64(order.OwnerRentAmountCent) / 100
if ownerRentAmount <= 0 || ownerRentAmount > rentAmount {
ownerRentAmount = rentAmount
}
total := roundMoney(rentAmount + depositAmount)
ownerRentAmount = roundMoney(ownerRentAmount)
settlement := arbitrationSettlement{}
orderID := order.ID
releaseFrozenAmount := minMoney(total, roundMoney(renterFrozenBalance))
@@ -398,21 +407,21 @@ func buildArbitrationSettlement(order model.RentalOrder, req ArbitrateRequest, r
return settlement, ErrInvalidDispute
}
addRenterRefund(req.Amount, "仲裁部分退款")
addOwnerIncome(minMoney(total-req.Amount, ownerRentAmount+order.DepositAmount), "仲裁剩余金额结算给号主")
addOwnerIncome(minMoney(total-req.Amount, ownerRentAmount+depositAmount), "仲裁剩余金额结算给号主")
case "release_deposit":
addOwnerIncome(ownerRentAmount, "仲裁确认订单金额结算给号主")
addRenterRefund(order.DepositAmount, "仲裁释放押金给租客")
addRenterRefund(depositAmount, "仲裁释放押金给租客")
case "deduct_deposit", "compensate_owner":
deductAmount := roundMoney(req.Amount)
if deductAmount <= 0 {
deductAmount = order.DepositAmount
deductAmount = depositAmount
}
if deductAmount > order.DepositAmount {
if deductAmount > depositAmount {
return settlement, ErrInvalidDispute
}
settlement.DepositDeductAmount = deductAmount
addOwnerIncome(ownerRentAmount+deductAmount, "仲裁订单金额及押金赔付结算给号主")
addRenterRefund(order.DepositAmount-deductAmount, "仲裁退回剩余押金给租客")
addRenterRefund(depositAmount-deductAmount, "仲裁退回剩余押金给租客")
case "order_close":
// Only release frozen funds. No available-balance settlement happens in development mode.
case "mark_abnormal":