第 4 阶段:订单、交接与账务--1

This commit is contained in:
yml
2026-05-22 16:05:40 +08:00
parent 9ac65ffad9
commit edda1fbc7b
16 changed files with 1102 additions and 5 deletions
+24
View File
@@ -0,0 +1,24 @@
package model
import (
"time"
"gorm.io/datatypes"
)
type HandoffRecord struct {
ID uint64 `gorm:"primaryKey" json:"id"`
OrderID uint64 `gorm:"not null;index" json:"order_id"`
FromUserID uint64 `gorm:"not null" json:"from_user_id"`
ToUserID uint64 `gorm:"not null" json:"to_user_id"`
Type string `gorm:"size:32;not null" json:"type"`
Content string `json:"content"`
AttachmentURLS datatypes.JSON `gorm:"column:attachment_urls" json:"attachment_urls"`
ConfirmedByRenterAt *time.Time `json:"confirmed_by_renter_at"`
ConfirmedByOwnerAt *time.Time `json:"confirmed_by_owner_at"`
CreatedAt time.Time `json:"created_at"`
}
func (HandoffRecord) TableName() string {
return "handoff_records"
}
+34
View File
@@ -0,0 +1,34 @@
package model
import (
"time"
"gorm.io/datatypes"
)
type RentalOrder struct {
ID uint64 `gorm:"primaryKey" json:"id"`
OrderNo string `gorm:"size:64;not null;uniqueIndex" json:"order_no"`
ListingID uint64 `gorm:"not null;index" json:"listing_id"`
AccountID uint64 `gorm:"not null;index" json:"account_id"`
OwnerID uint64 `gorm:"not null;index" json:"owner_id"`
RenterID uint64 `gorm:"not null;index" json:"renter_id"`
RentStartAt *time.Time `json:"rent_start_at"`
RentEndAt *time.Time `json:"rent_end_at"`
RentHours int `gorm:"not null" json:"rent_hours"`
RentAmount float64 `gorm:"type:decimal(12,2);not null;default:0" json:"rent_amount"`
DepositAmount float64 `gorm:"type:decimal(12,2);not null;default:0" json:"deposit_amount"`
PlatformFee float64 `gorm:"type:decimal(12,2);not null;default:0" json:"platform_fee"`
AccountSnapshot datatypes.JSON `json:"account_snapshot"`
Status string `gorm:"size:32;not null;default:'pending_confirm'" json:"status"`
HandoffStatus string `gorm:"size:32;not null;default:'none'" json:"handoff_status"`
SettlementStatus string `gorm:"size:32;not null;default:'unsettled'" json:"settlement_status"`
OwnerSettledAt *time.Time `json:"owner_settled_at"`
SettledAt *time.Time `json:"settled_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (RentalOrder) TableName() string {
return "rental_orders"
}