meta_info.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type StatusType string
  7. type SourceType string
  8. type MetaType string
  9. const (
  10. UserNoticeType MetaType = "USER_NOTICE"
  11. SysUserNoticeType MetaType = "SYS_USER_NOTICE"
  12. InitStatusType StatusType = "INIT"
  13. PendingStatusType StatusType = "PENDING"
  14. FinishStatusType StatusType = "FINISH"
  15. FailedStatusType StatusType = "FAILED"
  16. ReportSourceType SourceType = "REPORT"
  17. VideoSourceType SourceType = "VIDEO"
  18. AudioSourceType SourceType = "AUDIO"
  19. RefundSourceType SourceType = "REFUND"
  20. )
  21. // MetaInfo 表示 meta_infos 表的模型
  22. type MetaInfo struct {
  23. Id int `description:"id"`
  24. Meta string `description:"meta"`
  25. From string `description:"from"`
  26. To string `description:"column:to"`
  27. SourceType SourceType `description:"source_type"`
  28. MetaType MetaType `gorm:"column:meta_type;type:enum('USER_NOTICE','SYS_USER_NOTICE')"`
  29. Status StatusType `gorm:"column:status;type:enum('INIT','PENDING','FINISH','FAILED')"`
  30. CreatedTime time.Time
  31. UpdatedTime time.Time
  32. }
  33. type MetaData struct {
  34. SourceId int `json:"reportId"`
  35. AuthorId int `json:"AuthorId"`
  36. AuthorName string `json:"authorName"`
  37. PublishedTime string `json:"publishedTime"`
  38. }
  39. type RefundMetaData struct {
  40. ProductOrderNo string
  41. RealName string
  42. Result string
  43. }
  44. func (m *MetaInfo) TableName() string {
  45. return "meta_infos"
  46. }
  47. func (m *MetaInfo) Insert() (insert int64, err error) {
  48. o := orm.NewOrm()
  49. insert, err = o.Insert(m)
  50. return
  51. }