39 lines
2.0 KiB
Go
39 lines
2.0 KiB
Go
package plant
|
|
|
|
import (
|
|
"sundynix-go/global"
|
|
"time"
|
|
)
|
|
|
|
// ExchangeOrder 兑换订单
|
|
type ExchangeOrder struct {
|
|
global.BaseModel
|
|
UserId string `json:"userId" gorm:"index;size:50;not null;column:user_id"` // 用户ID
|
|
ItemId string `json:"itemId" gorm:"index;size:50;not null;column:item_id"` // 商品ID
|
|
ItemName string `json:"itemName" gorm:"size:100;column:item_name"` // 商品名称(冗余快照)
|
|
CostSunlight int64 `json:"costSunlight" gorm:"not null;default:0;column:cost_sunlight"` // 消耗阳光值
|
|
Quantity int `json:"quantity" gorm:"not null;default:1;column:quantity"` // 数量
|
|
Status int `json:"status" gorm:"not null;default:1;column:status"` // 1待处理 2处理中 3已发货 4已完成 5已取消
|
|
ItemType string `json:"itemType" gorm:"size:20;column:item_type"` // 商品类型快照
|
|
RecipientName string `json:"recipientName" gorm:"size:50;column:recipient_name"` // 收货人姓名
|
|
Phone string `json:"phone" gorm:"size:20;column:phone"` // 联系电话
|
|
Address string `json:"address" gorm:"size:255;column:address"` // 收货地址
|
|
TrackingNo string `json:"trackingNo" gorm:"size:100;column:tracking_no"` // 快递单号
|
|
Remark string `json:"remark" gorm:"size:255;column:remark"` // 备注
|
|
CompletedAt *time.Time `json:"completedAt" gorm:"column:completed_at"` // 完成时间
|
|
Item *ExchangeItem `json:"item" gorm:"foreignKey:ItemId"` // 商品关联
|
|
}
|
|
|
|
func (ExchangeOrder) TableName() string {
|
|
return "sundynix_exchange_order"
|
|
}
|
|
|
|
// 订单状态常量
|
|
const (
|
|
OrderStatusPending = 1 // 待处理
|
|
OrderStatusProcessing = 2 // 处理中
|
|
OrderStatusShipped = 3 // 已发货
|
|
OrderStatusCompleted = 4 // 已完成
|
|
OrderStatusCancelled = 5 // 已取消
|
|
)
|