dt_material.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package daytask
  2. // DtMaterial 素材表
  3. type DtMaterial struct {
  4. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:素材ID"`
  5. Name string `json:"name" gorm:"column:name;type:varchar(128);not null;comment:文件名"`
  6. Path string `json:"path" gorm:"column:path;type:varchar(512);not null;comment:文件路径"`
  7. Url string `json:"url" gorm:"column:url;type:varchar(512);not null;comment:访问URL"`
  8. Type string `json:"type" gorm:"column:type;type:varchar(32);not null;index:idx_type;comment:类型: image/video/audio/document"`
  9. MimeType string `json:"mimeType" gorm:"column:mime_type;type:varchar(128);comment:MIME类型"`
  10. Size int64 `json:"size" gorm:"column:size;type:bigint;default:0;comment:文件大小(字节)"`
  11. Width int `json:"width" gorm:"column:width;type:int;default:0;comment:宽度(图片/视频)"`
  12. Height int `json:"height" gorm:"column:height;type:int;default:0;comment:高度(图片/视频)"`
  13. Duration int `json:"duration" gorm:"column:duration;type:int;default:0;comment:时长(视频/音频,秒)"`
  14. Storage string `json:"storage" gorm:"column:storage;type:varchar(32);default:local;comment:存储: local/oss/cos"`
  15. GroupId int64 `json:"groupId" gorm:"column:group_id;type:bigint;default:0;index:idx_group_id;comment:分组ID"`
  16. AdminId int64 `json:"adminId" gorm:"column:admin_id;type:bigint;default:0;comment:上传管理员ID"`
  17. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;comment:创建时间"`
  18. }
  19. func (*DtMaterial) TableName() string {
  20. return "dt_material"
  21. }
  22. func NewDtMaterial() *DtMaterial {
  23. return &DtMaterial{}
  24. }
  25. // DtMaterialGroup 素材分组表
  26. type DtMaterialGroup struct {
  27. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:分组ID"`
  28. Name string `json:"name" gorm:"column:name;type:varchar(64);not null;comment:分组名称"`
  29. ParentId int64 `json:"parentId" gorm:"column:parent_id;type:bigint;default:0;index:idx_parent_id;comment:父级ID"`
  30. Sort int `json:"sort" gorm:"column:sort;type:int;default:0;comment:排序"`
  31. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;comment:创建时间"`
  32. UpdatedAt int64 `json:"updatedAt" gorm:"column:updated_at;type:bigint;autoUpdateTime;comment:更新时间"`
  33. }
  34. func (*DtMaterialGroup) TableName() string {
  35. return "dt_material_group"
  36. }
  37. func NewDtMaterialGroup() *DtMaterialGroup {
  38. return &DtMaterialGroup{}
  39. }