package yb

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

// Message 研报 消息表
type Message struct {
	MsgId               uint64      `orm:"column(msg_id);pk"  description:"消息序号"`
	UserId              uint64      `orm:"column(user_id)"  description:"用户id"`
	Type                int8        `orm:"column(type)"  description:"消息类型：1-留言回复通知，2-精选留言通知"`
	Enabled             int8        `orm:"column(enabled)"  description:"是否有效, 0-无效 1-有效"`
	CreateTime          time.Time   `orm:"column(create_time)"  description:"创建时间"`
	ModifyTime          time.Time   `orm:"column(modify_time)"  description:"修改时间"`
	CommentId           uint64      `orm:"column(comment_id)"  description:"留言ID"`
	IsRead              int8        `orm:"column(is_read)"  description:"是否已读 0-未读，1-已读"`
	ContentFirst        string      `orm:"column(content_first)"  description:"消息第一行留言内容"`
	ContentSecond       string      `orm:"column(content_second)"  description:"消息第二行内容"`
	ReportId            int         `orm:"column(report_id)"  description:"报告ID"`
	ReportChapterId     int         `orm:"column(report_chapter_id)"  description:"报告章节ID"`
	OldReportId         int         `orm:"column(old_report_id)" description:"老报告ID"`
	OldReportChapterId  int         `orm:"column(old_report_chapter_id)" description:"老报告章节ID"`
}

func (m *Message) TableName() string {
	return "yb_message"
}
// AddMessage 新增消息
func AddMessage(item *Message) (err error)  {
	o := orm.NewOrm()
	_, err = o.Insert(item)
	return
}