english_report.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package models
  2. import "github.com/beego/beego/v2/client/orm"
  3. type EnglishReportDetail struct {
  4. Id int `orm:"column(id)" description:"报告Id"`
  5. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  6. ClassifyIdFirst int `description:"一级分类id"`
  7. ClassifyNameFirst string `description:"一级分类名称"`
  8. ClassifyIdSecond int `description:"二级分类id"`
  9. ClassifyNameSecond string `description:"二级分类名称"`
  10. Title string `description:"标题"`
  11. Abstract string `description:"摘要"`
  12. Author string `description:"作者"`
  13. Frequency string `description:"频度"`
  14. CreateTime string `description:"创建时间"`
  15. ModifyTime string `description:"修改时间"`
  16. State int `description:"1:未发布,2:已发布"`
  17. PublishTime string `description:"发布时间"`
  18. Stage int `description:"期数"`
  19. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  20. Content string `description:"内容"`
  21. VideoUrl string `description:"音频文件URL"`
  22. VideoName string `description:"音频文件名称"`
  23. VideoPlaySeconds string `description:"音频播放时长"`
  24. ContentSub string `description:"内容前两个章节"`
  25. ThsMsgIsSend int `description:"客户群消息是否已发送,0:否,1:是"`
  26. HasChapter int `description:"是否有章节 0-否 1-是"`
  27. ChapterType string `description:"章节类型 day-晨报 week-周报"`
  28. Overview string `description:"英文概述部分"`
  29. }
  30. func GetEnglishReportByCode(reportCode string) (item *EnglishReportDetail, err error) {
  31. o := orm.NewOrm()
  32. sql := `SELECT * FROM english_report WHERE report_code=?`
  33. err = o.Raw(sql, reportCode).QueryRow(&item)
  34. return
  35. }
  36. type EnglishReportShareDetailResp struct {
  37. Report *EnglishReportDetail `description:"报告"`
  38. H5ShareEnName string `description:"研报分享抬头"`
  39. H5ReportShareImg string `description:"研报分享图片"`
  40. WatermarkChart string `description:"图表是否需要水印"`
  41. WatermarkReport string `description:"报告是否需要水印"`
  42. Hz int
  43. DisclaimerEn string `description:"免责声明"`
  44. ReportLogo string `description:"报告logo"`
  45. }
  46. func UpdateEnglishReportCounts(reportCode string) (err error) {
  47. o := orm.NewOrm()
  48. sql := `UPDATE english_report SET pv = pv+1 WHERE report_code = ? `
  49. _, err = o.Raw(sql, reportCode).Exec()
  50. return
  51. }
  52. func UpdateEnglishReportEmailCounts(reportCode string) (err error) {
  53. o := orm.NewOrm()
  54. sql := `UPDATE english_report SET pv_email = pv_email+1 WHERE report_code = ? `
  55. _, err = o.Raw(sql, reportCode).Exec()
  56. return
  57. }
  58. func GetTrialEnglishReportByCode(reportCode string) (item *EnglishReportDetail, err error) {
  59. o := orm.NewOrm()
  60. sql := `SELECT * FROM english_report WHERE report_code=?`
  61. err = o.Raw(sql, reportCode).QueryRow(&item)
  62. return
  63. }
  64. func UpdateTrialEnglishReportCounts(reportCode string) (err error) {
  65. o := orm.NewOrm()
  66. sql := `UPDATE english_report SET pv = pv+1 WHERE report_code = ? `
  67. _, err = o.Raw(sql, reportCode).Exec()
  68. return
  69. }
  70. func UpdateTrialEnglishReportEmailCounts(reportCode string) (err error) {
  71. o := orm.NewOrm()
  72. sql := `UPDATE english_report SET pv_email = pv_email+1 WHERE report_code = ? `
  73. _, err = o.Raw(sql, reportCode).Exec()
  74. return
  75. }