report_chapter.go 2.2 KB

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