english_report.go 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type EnglishReport struct {
  6. Id int `orm:"column(id)" description:"报告Id"`
  7. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  8. ClassifyIdFirst int `description:"一级分类id"`
  9. ClassifyNameFirst string `description:"一级分类名称"`
  10. ClassifyIdSecond int `description:"二级分类id"`
  11. ClassifyNameSecond string `description:"二级分类名称"`
  12. Title string `description:"标题"`
  13. Abstract string `description:"摘要"`
  14. Author string `description:"作者"`
  15. Frequency string `description:"频度"`
  16. CreateTime string `description:"创建时间"`
  17. ModifyTime string `description:"修改时间"`
  18. State int `description:"1:未发布,2:已发布"`
  19. PublishTime string `description:"发布时间"`
  20. PrePublishTime string `description:"预发布时间"`
  21. Stage int `description:"期数"`
  22. Content string `description:"内容"`
  23. VideoUrl string `description:"音频文件URL"`
  24. VideoName string `description:"音频文件名称"`
  25. VideoPlaySeconds string `description:"音频播放时长"`
  26. VideoSize string `description:"音频文件大小,单位M"`
  27. ContentSub string `description:"内容前两个章节"`
  28. ReportCode string `description:"报告唯一编码"`
  29. Pv int `description:"Pv"`
  30. PvEmail int `description:"邮箱PV"`
  31. EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"`
  32. Overview string `description:"英文概述部分"`
  33. KeyTakeaways string `description:"关键点"`
  34. FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
  35. AdminId int `description:"创建者账号"`
  36. AdminRealName string `description:"创建者姓名"`
  37. }
  38. type EnglishReportDetail struct {
  39. Id int `orm:"column(id)" description:"报告Id"`
  40. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  41. ClassifyIdFirst int `description:"一级分类id"`
  42. ClassifyNameFirst string `description:"一级分类名称"`
  43. ClassifyIdSecond int `description:"二级分类id"`
  44. ClassifyNameSecond string `description:"二级分类名称"`
  45. Title string `description:"标题"`
  46. Abstract string `description:"摘要"`
  47. Author string `description:"作者"`
  48. Frequency string `description:"频度"`
  49. CreateTime string `description:"创建时间"`
  50. ModifyTime string `description:"修改时间"`
  51. State int `description:"1:未发布,2:已发布"`
  52. PublishTime string `description:"发布时间"`
  53. Stage int `description:"期数"`
  54. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  55. ReportCode string `description:"报告唯一编码"`
  56. Content string `description:"内容"`
  57. VideoUrl string `description:"音频文件URL"`
  58. VideoName string `description:"音频文件名称"`
  59. VideoPlaySeconds string `description:"音频播放时长"`
  60. ContentSub string `description:"内容前两个章节"`
  61. Pv int `description:"Pv"`
  62. Overview string `description:"英文概述部分"`
  63. FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
  64. KeyTakeaways string `description:"关键点"`
  65. }
  66. type ElasticEnglishReportDetail struct {
  67. Id string `description:"报告id或者线上路演Id"`
  68. ReportId int `description:"报告id"`
  69. VideoId int `description:"线上路演Id"`
  70. ClassifyIdFirst int `description:"一级分类id"`
  71. ClassifyNameFirst string `description:"一级分类名称"`
  72. ClassifyIdSecond int `description:"二级分类id"`
  73. ClassifyNameSecond string `description:"二级分类名称"`
  74. StageStr string `description:"报告期数"`
  75. Title string `description:"标题"`
  76. Abstract string `description:"摘要"`
  77. Author string `description:"作者"`
  78. Frequency string `description:"频度"`
  79. PublishState int `description:"状态:1:未发布,2:已发布"`
  80. BodyContent string `description:"内容"`
  81. ContentSub string `description:"前两段内容"`
  82. CreateTime string `description:"创建时间"`
  83. PublishTime string `description:"发布时间"`
  84. ReportCode string `description:"报告唯一编码"`
  85. Overview string `description:"英文概述部分"`
  86. }
  87. // GetPrePublishedEnglishReports 获取定时发布时间为当前时间的未发布的英文报告列表
  88. func GetPrePublishedEnglishReports(startTime, endTime, afterDate string) (list []*EnglishReport, err error) {
  89. o := orm.NewOrmUsingDB("rddp")
  90. sql := `SELECT * FROM english_report WHERE state = 1 and pre_publish_time >= ? and pre_publish_time <= ? and modify_time >= ?`
  91. _, err = o.Raw(sql, startTime, endTime, afterDate).QueryRows(&list)
  92. return
  93. }
  94. // PublishEnglishReportById 发布报告
  95. func PublishEnglishReportById(reportId int, publishTime string) (err error) {
  96. o := orm.NewOrmUsingDB("rddp")
  97. sql := `UPDATE english_report SET state=2, publish_time=?, modify_time=NOW() WHERE id = ? `
  98. _, err = o.Raw(sql, publishTime, reportId).Exec()
  99. return
  100. }
  101. func GetEnglishReportById(reportId int) (item *EnglishReportDetail, err error) {
  102. o := orm.NewOrmUsingDB("rddp")
  103. sql := `SELECT * FROM english_report WHERE id=?`
  104. err = o.Raw(sql, reportId).QueryRow(&item)
  105. return
  106. }
  107. // GetReportByReportId 主键获取报告
  108. func GetReportByReportId(reportId int) (item *Report, err error) {
  109. o := orm.NewOrmUsingDB("rddp")
  110. sql := `SELECT * FROM report WHERE id = ?`
  111. err = o.Raw(sql, reportId).QueryRow(&item)
  112. return
  113. }
  114. // Update 更新
  115. func (item *EnglishReport) Update(cols []string) (err error) {
  116. o := orm.NewOrmUsingDB("rddp")
  117. _, err = o.Update(item, cols...)
  118. return
  119. }