修复超时订单重置流程

This commit is contained in:
yml2213
2026-06-19 18:36:46 +08:00
parent 2df935f74c
commit 72285ed638
11 changed files with 449 additions and 46 deletions
@@ -8,6 +8,19 @@ import (
"gorm.io/datatypes"
)
func adminActionsForOrder(order model.RentalOrder) *AdminActionsDTO {
target, ok := resetTargetForOrder(order)
if !ok {
return nil
}
return &AdminActionsDTO{
ResetHandoff: &AdminActionDTO{
Enabled: true,
Label: target.Label,
},
}
}
func (row orderRow) toAdminDTO() OrderDTO {
rentedAt := row.RentedAt
durationHours := orderDurationHours(row.RentalOrder)
@@ -43,6 +56,7 @@ func (row orderRow) toAdminDTO() OrderDTO {
Status: row.Status,
HandoffStatus: row.HandoffStatus,
SettlementStatus: row.SettlementStatus,
AdminActions: adminActionsForOrder(row.RentalOrder),
CreatedAt: row.CreatedAt,
UpdatedAt: row.UpdatedAt,
}
@@ -50,6 +64,7 @@ func (row orderRow) toAdminDTO() OrderDTO {
func (row orderRow) toDTOForUser(userID uint64) OrderDTO {
dto := row.toAdminDTO()
dto.AdminActions = nil
applyOrderPriceView(&dto, row.RentalOrder, userID)
return dto
}