package model import ( "time" ) // Order 订单模型 type Order struct { ID uint `gorm:"primaryKey" json:"id"` OrderNo string `gorm:"uniqueIndex;size:32" json:"orderNo"` // 订单号 UserID uint `gorm:"index" json:"userId"` Type string `gorm:"size:20" json:"type"` // wish:许愿 vip:会员 ProductID uint `json:"productId"` ProductName string `gorm:"size:100" json:"productName"` Amount int `json:"amount"` // 金额(分) Status string `gorm:"size:20;default:'pending'" json:"status"` // pending:待支付 paid:已支付 cancelled:已取消 refunded:已退款 PayTime *time.Time `json:"payTime"` ExpireTime *time.Time `json:"expireTime"` Remark string `gorm:"size:255" json:"remark"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } // OrderItem 订单项 type OrderItem struct { ID uint `gorm:"primaryKey" json:"id"` OrderID uint `gorm:"index" json:"orderId"` ProductID uint `json:"productId"` Name string `gorm:"size:100" json:"name"` Price int `json:"price"` // 单价(分) Quantity int `json:"quantity"` // 数量 }