1.0
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// OrderMessage 订单留言模型
|
||||
type OrderMessage struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
OrderID uint `gorm:"not null;index" json:"order_id"` // 订单ID
|
||||
OrderType string `gorm:"type:varchar(20);not null;default:'purchase'" json:"order_type"` // 订单类型:purchase(买单), sales(卖单)
|
||||
UserID uint `gorm:"not null;index" json:"user_id"` // 留言用户ID
|
||||
Content string `gorm:"type:text;not null" json:"content"` // 留言内容
|
||||
Images string `gorm:"type:text" json:"images"` // 留言图片,多个图片用逗号分隔
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// 关联关系
|
||||
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (OrderMessage) TableName() string {
|
||||
return "order_messages"
|
||||
}
|
||||
Reference in New Issue
Block a user