message.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // Message 研报 消息表
  7. type Message struct {
  8. MsgId uint64 `orm:"column(msg_id);pk" description:"消息序号"`
  9. UserId uint64 `orm:"column(user_id)" description:"用户id"`
  10. Type int8 `orm:"column(type)" description:"消息类型:1-留言回复通知,2-精选留言通知"`
  11. Enabled int8 `orm:"column(enabled)" description:"是否有效, 0-无效 1-有效"`
  12. CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
  13. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  14. CommentId uint64 `orm:"column(comment_id)" description:"留言ID"`
  15. IsRead int8 `orm:"column(is_read)" description:"是否已读 0-未读,1-已读"`
  16. ContentFirst string `orm:"column(content_first)" description:"消息第一行留言内容"`
  17. ContentSecond string `orm:"column(content_second)" description:"消息第二行内容"`
  18. ReportId int `orm:"column(report_id)" description:"报告ID"`
  19. ReportChapterId int `orm:"column(report_chapter_id)" description:"报告章节ID"`
  20. OldReportId int `orm:"column(old_report_id)" description:"老报告ID"`
  21. OldReportChapterId int `orm:"column(old_report_chapter_id)" description:"老报告章节ID"`
  22. }
  23. func (m *Message) TableName() string {
  24. return "yb_message"
  25. }
  26. // AddMessage 新增消息
  27. func AddMessage(item *Message) (err error) {
  28. o := orm.NewOrm()
  29. _, err = o.Insert(item)
  30. return
  31. }