package models import ( "github.com/beego/beego/v2/client/orm" ) type EnglishReport struct { Id int `orm:"column(id)" description:"报告Id"` AddType int `description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` Title string `description:"标题"` Abstract string `description:"摘要"` Author string `description:"作者"` Frequency string `description:"频度"` CreateTime string `description:"创建时间"` ModifyTime string `description:"修改时间"` State int `description:"1:未发布,2:已发布"` PublishTime string `description:"发布时间"` PrePublishTime string `description:"预发布时间"` Stage int `description:"期数"` Content string `description:"内容"` VideoUrl string `description:"音频文件URL"` VideoName string `description:"音频文件名称"` VideoPlaySeconds string `description:"音频播放时长"` VideoSize string `description:"音频文件大小,单位M"` ContentSub string `description:"内容前两个章节"` ReportCode string `description:"报告唯一编码"` Pv int `description:"Pv"` PvEmail int `description:"邮箱PV"` EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"` Overview string `description:"英文概述部分"` KeyTakeaways string `description:"关键点"` FromReportId int `description:"继承的报告ID(英文策略报告ID)"` AdminId int `description:"创建者账号"` AdminRealName string `description:"创建者姓名"` } type EnglishReportDetail struct { Id int `orm:"column(id)" description:"报告Id"` AddType int `description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` Title string `description:"标题"` Abstract string `description:"摘要"` Author string `description:"作者"` Frequency string `description:"频度"` CreateTime string `description:"创建时间"` ModifyTime string `description:"修改时间"` State int `description:"1:未发布,2:已发布"` PublishTime string `description:"发布时间"` Stage int `description:"期数"` MsgIsSend int `description:"消息是否已发送,0:否,1:是"` ReportCode string `description:"报告唯一编码"` Content string `description:"内容"` VideoUrl string `description:"音频文件URL"` VideoName string `description:"音频文件名称"` VideoPlaySeconds string `description:"音频播放时长"` ContentSub string `description:"内容前两个章节"` Pv int `description:"Pv"` Overview string `description:"英文概述部分"` FromReportId int `description:"继承的报告ID(英文策略报告ID)"` KeyTakeaways string `description:"关键点"` } type ElasticEnglishReportDetail struct { Id string `description:"报告id或者线上路演Id"` ReportId int `description:"报告id"` VideoId int `description:"线上路演Id"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` StageStr string `description:"报告期数"` Title string `description:"标题"` Abstract string `description:"摘要"` Author string `description:"作者"` Frequency string `description:"频度"` PublishState int `description:"状态:1:未发布,2:已发布"` BodyContent string `description:"内容"` ContentSub string `description:"前两段内容"` CreateTime string `description:"创建时间"` PublishTime string `description:"发布时间"` ReportCode string `description:"报告唯一编码"` Overview string `description:"英文概述部分"` } // GetPrePublishedEnglishReports 获取定时发布时间为当前时间的未发布的英文报告列表 func GetPrePublishedEnglishReports(startTime, endTime, afterDate string) (list []*EnglishReport, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM english_report WHERE state = 1 and pre_publish_time >= ? and pre_publish_time <= ? and modify_time >= ?` _, err = o.Raw(sql, startTime, endTime, afterDate).QueryRows(&list) return } // PublishEnglishReportById 发布报告 func PublishEnglishReportById(reportId int, publishTime string) (err error) { o := orm.NewOrmUsingDB("rddp") sql := `UPDATE english_report SET state=2, publish_time=?, modify_time=NOW() WHERE id = ? ` _, err = o.Raw(sql, publishTime, reportId).Exec() return } func GetEnglishReportById(reportId int) (item *EnglishReportDetail, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM english_report WHERE id=?` err = o.Raw(sql, reportId).QueryRow(&item) return } // GetReportByReportId 主键获取报告 func GetReportByReportId(reportId int) (item *Report, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM report WHERE id = ?` err = o.Raw(sql, reportId).QueryRow(&item) return } // Update 更新 func (item *EnglishReport) Update(cols []string) (err error) { o := orm.NewOrmUsingDB("rddp") _, err = o.Update(item, cols...) return }