report_chapter.go 2.5 KB

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