package models import ( "gorm.io/gorm" ) type Server struct { gorm.Model Title string `json:"title" gorm:"comment:'标题'"` Synopsis string `json:"synopsis" gorm:"comment:'简介'"` //简介 Detail string `json:"detail" gorm:"comment:'详情'"` //详情 ProductId uint `json:"product_id" gorm:"comment:'产品ID'"` //产品id Image string `json:"image" gorm:"comment:'图片链接'"` } type ServerDto struct { ID uint `json:"id"` Title string `json:"title" validate:"required"` Synopsis string `json:"synopsis" validate:"required"` //简介 Detail string `json:"detail" validate:"required"` //详情 ProductId uint `json:"product_id" validate:"required"` //产品id Image string `json:"image" validate:"required"` }