123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- package models
- import (
- "eta/eta_hub/utils"
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // ReportChapter 报告章节
- type ReportChapter struct {
- ReportChapterId int `orm:"column(report_chapter_id);pk" description:"报告章节ID"`
- ReportId int `description:"报告ID"`
- ReportType string `description:"报告类型 day-晨报 week-周报"`
- ClassifyIdFirst int `description:"一级分类id"`
- ClassifyNameFirst string `description:"一级分类名称"`
- TypeId int `description:"品种ID"`
- TypeName string `description:"品种名称"`
- Title string `description:"标题"`
- Abstract string `description:"摘要"`
- AddType int `description:"新增方式:1:新增报告,2:继承报告"`
- Author string `description:"作者"`
- Content string `description:"内容"`
- ContentSub string `description:"内容前两个章节"`
- Stage int `description:"期数"`
- Trend string `description:"趋势观点"`
- Sort int `description:"排序: 数值越小越靠前"`
- IsEdit int `description:"是否已编辑 0-待编辑 1-已编辑"`
- PublishState int `description:"发布状态 1-待发布,2-已发布"`
- PublishTime time.Time `description:"发布时间"`
- VideoUrl string `description:"音频文件URL"`
- VideoName string `description:"音频文件名称"`
- VideoPlaySeconds string `description:"音频播放时长"`
- VideoSize string `description:"音频文件大小,单位M"`
- VideoKind int `description:"音频生成方式:1,手动上传,2:自动生成"`
- CreateTime string `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- OriginalVideoUrl string `description:"原始音频文件URL"`
- ContentStruct string `description:"内容组件"`
- LastModifyAdminId int `description:"最后更新人ID"`
- LastModifyAdminName string `description:"最后更新人姓名"`
- ContentModifyTime time.Time `description:"内容更新时间"`
- ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
- ReportCreateTime time.Time `description:"报告时间创建时间"`
- }
- // GetChapterListByReportId 根据ReportId获取章节列表
- func GetChapterListByReportId(reportId int) (list []*ReportChapter, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := ` SELECT * FROM report_chapter WHERE report_id = ? ORDER BY sort ASC`
- _, err = o.Raw(sql, reportId).QueryRows(&list)
- return
- }
- type ReportChapterItem struct {
- ReportChapterId int `orm:"column(report_chapter_id);pk" description:"报告章节ID"`
- ReportId int `description:"报告ID"`
- ReportType string `json:"-" description:"报告类型 day-晨报 week-周报"`
- ClassifyIdFirst int `description:"一级分类id"`
- ClassifyNameFirst string `description:"一级分类名称"`
- TypeId int `description:"品种ID"`
- TypeName string `description:"品种名称"`
- Title string `description:"标题"`
- Abstract string `description:"摘要"`
- AddType int `description:"新增方式:1:新增报告,2:继承报告"`
- Author string `description:"作者"`
- Content string `description:"内容"`
- ContentSub string `json:"-" description:"内容前两个章节"`
- Stage int `description:"期数"`
- Trend string `description:"趋势观点"`
- Sort int `description:"排序: 数值越小越靠前"`
- IsEdit int `description:"是否已编辑 0-待编辑 1-已编辑"`
- PublishState int `description:"发布状态 1-待发布,2-已发布"`
- PublishTime string `description:"发布时间"`
- VideoUrl string `description:"音频文件URL"`
- VideoName string `description:"音频文件名称"`
- VideoPlaySeconds string `description:"音频播放时长"`
- VideoSize string `description:"音频文件大小,单位M"`
- VideoKind int `description:"音频生成方式:1,手动上传,2:自动生成"`
- CreateTime string `description:"创建时间"`
- //ModifyTime string `description:"修改时间"`
- OriginalVideoUrl string `json:"-" description:"原始音频文件URL"`
- //ContentStruct string `description:"内容组件"`
- LastModifyAdminId int `json:"-" description:"最后更新人ID"`
- LastModifyAdminName string `json:"-" description:"最后更新人姓名"`
- ContentModifyTime string `description:"内容更新时间"`
- ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
- ReportCreateTime string `description:"报告时间创建时间"`
- }
- func FormatReportChapterItem(origin *ReportChapter) (item *ReportChapterItem) {
- if origin == nil {
- return
- }
- item = &ReportChapterItem{
- ReportChapterId: origin.ReportChapterId,
- ReportId: origin.ReportId,
- ReportType: origin.ReportType,
- ClassifyIdFirst: origin.ClassifyIdFirst,
- ClassifyNameFirst: origin.ClassifyNameFirst,
- TypeId: origin.TypeId,
- TypeName: origin.TypeName,
- Title: origin.Title,
- Abstract: origin.Abstract,
- AddType: origin.AddType,
- Author: origin.Author,
- Content: origin.Content,
- ContentSub: origin.ContentSub,
- Stage: origin.Stage,
- Trend: origin.Trend,
- Sort: origin.Sort,
- IsEdit: origin.IsEdit,
- PublishState: origin.PublishState,
- PublishTime: utils.TimeTransferString(utils.FormatDateTime, origin.PublishTime),
- VideoUrl: origin.VideoUrl,
- VideoName: origin.VideoName,
- VideoPlaySeconds: origin.VideoPlaySeconds,
- VideoSize: origin.VideoSize,
- VideoKind: origin.VideoKind,
- CreateTime: origin.CreateTime,
- OriginalVideoUrl: origin.OriginalVideoUrl,
- //LastModifyAdminId: origin.LastModifyAdminId,
- //LastModifyAdminName: origin.LastModifyAdminName,
- ContentModifyTime: utils.TimeTransferString(utils.FormatDateTime, origin.ContentModifyTime),
- ReportLayout: origin.ReportLayout,
- ReportCreateTime: utils.TimeTransferString(utils.FormatDateTime, origin.ReportCreateTime),
- }
- return
- }
- // GetPublishedChapterListByReportId 根据ReportId获取已发布章节列表
- func GetPublishedChapterListByReportId(reportId int) (list []*ReportChapter, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := ` SELECT * FROM report_chapter WHERE report_id = ? AND publish_state = 2 ORDER BY sort ASC`
- _, err = o.Raw(sql, reportId).QueryRows(&list)
- return
- }
|