report_chapter.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "eta_gn/eta_report/global"
  4. "time"
  5. )
  6. // ReportChapter 报告章节
  7. type ReportChapter struct {
  8. ReportChapterId int `gorm:"primaryKey;autoIncrement;column:reportChapterId"`
  9. ReportId int `gorm:"column:report_id" description:"报告ID"`
  10. ReportType string `gorm:"column:report_type" description:"报告类型 day-晨报 week-周报"`
  11. ClassifyIdFirst int `gorm:"column:classify_id_first" description:"一级分类id"`
  12. ClassifyNameFirst string `gorm:"column:classify_name_first" description:"一级分类名称"`
  13. TypeId int `gorm:"column:type_id" description:"品种ID"`
  14. TypeName string `gorm:"column:type_name" description:"品种名称"`
  15. Title string `gorm:"column:title" description:"标题"`
  16. Abstract string `gorm:"column:abstract" description:"摘要"`
  17. AddType int `gorm:"column:add_type" description:"新增方式:1:新增报告,2:继承报告"`
  18. Author string `gorm:"column:author" description:"作者"`
  19. Content string `gorm:"column:content" description:"内容"`
  20. ContentSub string `gorm:"column:content_sub" description:"内容前两个章节"`
  21. Stage int `gorm:"column:stage" description:"期数"`
  22. Trend string `gorm:"column:trend" description:"趋势观点"`
  23. Sort int `gorm:"column:sort" description:"排序: 数值越小越靠前"`
  24. IsEdit int `gorm:"column:is_edit" description:"是否已编辑 0-待编辑 1-已编辑"`
  25. PublishState int `gorm:"column:publish_state" description:"发布状态 1-待发布,2-已发布"`
  26. PublishTime time.Time `gorm:"column:publish_time" description:"发布时间"`
  27. VideoUrl string `gorm:"column:video_url" description:"音频文件URL"`
  28. VideoName string `gorm:"column:video_name" description:"音频文件名称"`
  29. VideoPlaySeconds string `gorm:"column:video_play_seconds" description:"音频播放时长"`
  30. VideoSize string `gorm:"column:video_size" description:"音频文件大小,单位M"`
  31. VideoKind int `gorm:"column:video_kind" description:"音频生成方式:1,手动上传,2:自动生成"`
  32. CreateTime string `gorm:"column:create_time" description:"创建时间"`
  33. ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
  34. OriginalVideoUrl string `gorm:"column:original_video_url" description:"原始音频文件URL"`
  35. }
  36. // GetPublishedChapterListByReportId 根据ReportId获取已发布章节列表
  37. func GetPublishedChapterListByReportId(reportId int) (list []*ReportChapter, err error) {
  38. sql := ` SELECT * FROM report_chapter WHERE report_id = ? AND publish_state = 2 ORDER BY sort ASC`
  39. err = global.DEFAULT_DmSQL.Raw(sql, reportId).Find(&list).Error
  40. return
  41. }