base_model.go 877 B

1234567891011121314151617181920212223242526272829
  1. package model
  2. import (
  3. "time"
  4. "gorm.io/gorm"
  5. )
  6. type BaseModel struct {
  7. ID int `json:"id" form:"id" gorm:"primaryKey"`
  8. CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
  9. UpdateAt time.Time `json:"-" gorm:"autoUpdateTime"`
  10. DeletedAt gorm.DeletedAt `json:"-" gorm:"column:delete_at"`
  11. }
  12. const (
  13. UserDocStatus_Normal = 0 //文件正常
  14. UserDocStatus_LogicDelete = 1 //删除
  15. UserDocStatus_PermanentlyDelete = 2 //永久删除
  16. UserDocCategory_SelfUpload = 0 //自己上传
  17. UserDocCategory_Download = 1 //转存(下载)
  18. UserDocCategory_Collect = 2 //收藏
  19. //es
  20. Es_JyDoc = "jydoc" //es中文库的别名
  21. )
  22. var (
  23. DocFileType = map[int]string{1: "doc", 2: "pdf", 3: "xls", 4: "ppt", 5: "txt", 6: "其他"}
  24. )