package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type StatusType string type SourceType string type MetaType string const ( UserNoticeType MetaType = "USER_NOTICE" SysUserNoticeType MetaType = "SYS_USER_NOTICE" InitStatusType StatusType = "INIT" PendingStatusType StatusType = "PENDING" FinishStatusType StatusType = "FINISH" FailedStatusType StatusType = "FAILED" ReportSourceType SourceType = "REPORT" VideoSourceType SourceType = "VIDEO" AudioSourceType SourceType = "AUDIO" RefundSourceType SourceType = "REFUND" ) // MetaInfo 表示 meta_infos 表的模型 type MetaInfo struct { Id int `description:"id"` Meta string `description:"meta"` From string `description:"from"` To string `description:"column:to"` SourceType SourceType `description:"source_type"` MetaType MetaType `gorm:"column:meta_type;type:enum('USER_NOTICE','SYS_USER_NOTICE')"` Status StatusType `gorm:"column:status;type:enum('INIT','PENDING','FINISH','FAILED')"` CreatedTime time.Time UpdatedTime time.Time } type MetaData struct { SourceId int `json:"reportId"` AuthorId int `json:"AuthorId"` AuthorName string `json:"authorName"` PublishedTime string `json:"publishedTime"` } type RefundMetaData struct { ProductOrderNo string RealName string Result string } func (m *MetaInfo) TableName() string { return "meta_infos" } func (m *MetaInfo) Insert() (insert int64, err error) { o := orm.NewOrm() insert, err = o.Insert(m) return }