统一订单单状态模型

This commit is contained in:
yml2213
2026-07-31 17:02:19 +08:00
parent 677bdbbc1c
commit 04130e5ec8
19 changed files with 300 additions and 345 deletions
+8 -13
View File
@@ -34,16 +34,12 @@ const (
ProductStatusActive = "active"
ProductStatusInactive = "inactive"
PaymentStatusPending = "pending"
PaymentStatusPaid = "paid"
PaymentStatusRefunded = "refunded"
PaymentStatusCancelled = "cancelled"
FulfillmentStatusPending = "pending"
FulfillmentStatusProcessing = "processing"
FulfillmentStatusSucceeded = "succeeded"
FulfillmentStatusFailed = "failed"
FulfillmentStatusCancelled = "cancelled"
OrderStatusPending = "pending" // 待支付(当前无真实支付流程,仅预留)
OrderStatusPaid = "paid" // 已扣款,待发货
OrderStatusDelivering = "delivering" // 发货中
OrderStatusDelivered = "delivered" // 已交付
OrderStatusShipFailed = "ship_failed" // 发货失败(可重试)
OrderStatusCancelled = "cancelled" // 已取消并退款
WalletLedgerCredit = "credit"
WalletLedgerDebit = "debit"
@@ -189,7 +185,7 @@ type WalletLedgerEntry struct {
Note string `gorm:"size:255" json:"note"`
}
// FulfillmentOrder 将支付和履约状态拆分,并保留商品及请求快照。
// FulfillmentOrder 保留订单状态、商品及请求快照。
type FulfillmentOrder struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
@@ -210,8 +206,7 @@ type FulfillmentOrder struct {
ServiceFeeAmount int64 `gorm:"not null;default:0" json:"service_fee_amount"`
Amount int64 `gorm:"not null" json:"amount"`
Currency string `gorm:"size:12;not null;default:POINT" json:"currency"`
PaymentStatus string `gorm:"size:16;not null;default:pending;index" json:"payment_status"`
FulfillmentStatus string `gorm:"size:16;not null;default:pending;index" json:"fulfillment_status"`
OrderStatus string `gorm:"size:16;not null;default:paid;index" json:"order_status"`
BuyerReference string `gorm:"size:128" json:"buyer_reference"`
RequestFingerprint string `gorm:"size:64;not null;default:'';index" json:"-"`
RequestData string `gorm:"type:text" json:"request_data"`