[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
+33 -18
View File
@@ -185,11 +185,17 @@ func (r *Repository) Create(renterID uint64, req CreateRequest) (*OrderDTO, erro
OwnerID: listing.OwnerID,
RenterID: renterID,
EstimatedDurationHours: rentHours,
RentAmount: float64(pricing.RentAmountCent) / 100,
RentAmountCent: pricing.RentAmountCent,
OwnerRentAmount: float64(pricing.OwnerRentAmountCent) / 100,
OwnerRentAmountCent: pricing.OwnerRentAmountCent,
DepositAmount: paidDepositAmount,
DepositAmountCent: int64(math.Round(paidDepositAmount * 100)),
DepositOriginalAmount: depositOriginalAmount,
DepositOriginalAmountCent: int64(math.Round(depositOriginalAmount * 100)),
DepositWaivedAmount: waivedDepositAmount,
DepositWaivedAmountCent: int64(math.Round(waivedDepositAmount * 100)),
PlatformFee: float64(pricing.PlatformFeeCent) / 100,
PlatformFeeCent: pricing.PlatformFeeCent,
AccountSnapshot: snapshot,
Status: "pending_payment",
@@ -690,10 +696,10 @@ func (r *Repository) CounterCheckout(userID uint64, orderID uint64, req CounterC
return nil, err
}
dto := toCheckoutDTOForUser(*checkout, userID, model.RentalOrder{
OwnerID: userID,
RentAmountCent: int64(math.Round(checkout.RentAmount * 100)),
OwnerID: userID,
RentAmountCent: int64(math.Round(checkout.RentAmount * 100)),
OwnerRentAmountCent: int64(math.Round(checkout.OwnerRentAmount * 100)),
DepositAmountCent: int64(math.Round(checkout.DepositAmount * 100)),
DepositAmountCent: int64(math.Round(checkout.DepositAmount * 100)),
})
return &dto, nil
}
@@ -1244,21 +1250,30 @@ func buildCheckout(order model.RentalOrder, initiatedBy uint64, status string, c
return model.OrderCheckout{}, err
}
return model.OrderCheckout{
OrderID: order.ID,
InitiatedBy: initiatedBy,
Status: status,
RentAmount: float64(settlement.ActualRentAmountCent) / 100,
OwnerRentAmount: float64(settlement.OwnerRentIncomeCent) / 100,
PlatformFee: float64(settlement.PlatformFeeCent) / 100,
DepositAmount: depositAmountFromCent,
ConsumableAmount: consumableAmount,
CoinConsumedM: roundQuantity(coinConsumedM),
OtherAmount: otherAmount,
DepositDeductAmount: roundMoney(deductAmount),
RenterRefundAmount: float64(settlement.RenterRefundCent) / 100,
OwnerIncomeAmount: float64(settlement.OwnerIncomeCent) / 100,
Content: content,
EvidenceURLS: evidence,
OrderID: order.ID,
InitiatedBy: initiatedBy,
Status: status,
RentAmount: float64(settlement.ActualRentAmountCent) / 100,
RentAmountCent: settlement.ActualRentAmountCent,
OwnerRentAmount: float64(settlement.OwnerRentIncomeCent) / 100,
OwnerRentAmountCent: settlement.OwnerRentIncomeCent,
PlatformFee: float64(settlement.PlatformFeeCent) / 100,
PlatformFeeCent: settlement.PlatformFeeCent,
DepositAmount: depositAmountFromCent,
DepositAmountCent: order.DepositAmountCent,
ConsumableAmount: consumableAmount,
ConsumableAmountCent: int64(math.Round(consumableAmount * 100)),
CoinConsumedM: roundQuantity(coinConsumedM),
OtherAmount: otherAmount,
OtherAmountCent: int64(math.Round(otherAmount * 100)),
DepositDeductAmount: roundMoney(deductAmount),
DepositDeductAmountCent: settlement.DepositCompensationCent,
RenterRefundAmount: float64(settlement.RenterRefundCent) / 100,
RenterRefundAmountCent: settlement.RenterRefundCent,
OwnerIncomeAmount: float64(settlement.OwnerIncomeCent) / 100,
OwnerIncomeAmountCent: settlement.OwnerIncomeCent,
Content: content,
EvidenceURLS: evidence,
}, nil
}