serve.go 1016 B

12345678910111213141516171819202122232425
  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. ParentId int `gorm:"comment:'父级id'" json:"parentId"`
  13. Image string `json:"image" gorm:"comment:'图片链接'"`
  14. }
  15. type ServerDto struct {
  16. ID uint `json:"id"`
  17. Title string `json:"title" validate:"required", min`
  18. Synopsis template.HTML `json:"synopsis" validate:"required"` //简介
  19. Detail template.HTML `json:"detail" validate:"required"` //详情
  20. ProductId uint `json:"product_id" validate:"required"` //产品id
  21. ParentId int `json:"parentId" validate:"required"`
  22. Image string `json:"image" validate:"required"`
  23. }