serve.go 879 B

1234567891011121314151617181920212223
  1. package models
  2. import (
  3. "gorm.io/gorm"
  4. "html/template"
  5. )
  6. type Server struct {
  7. gorm.Model
  8. Title string `json:"title" gorm:"comment:'标题'"`
  9. Synopsis template.HTML `json:"synopsis" gorm:"comment:'简介'"` //简介
  10. Detail template.HTML `json:"detail" gorm:"comment:'详情'"` //详情
  11. ProductId uint `json:"product_id" gorm:"comment:'产品ID'"` //产品id
  12. Image string `json:"image" gorm:"comment:'图片链接'"`
  13. }
  14. type ServerDto struct {
  15. ID uint `json:"id"`
  16. Title string `json:"title" validate:"required"`
  17. Synopsis template.HTML `json:"synopsis" validate:"required"` //简介
  18. Detail template.HTML `json:"detail" validate:"required"` //详情
  19. ProductId uint `json:"product_id" validate:"required"` //产品id
  20. Image string `json:"image" validate:"required"`
  21. }