english_report.go 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.NewOrmUsingDB("rddp")
  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. Hz int
  41. }
  42. func UpdateEnglishReportCounts(reportCode string) (err error) {
  43. o := orm.NewOrmUsingDB("rddp")
  44. sql := `UPDATE english_report SET pv = pv+1 WHERE report_code = ? `
  45. _, err = o.Raw(sql, reportCode).Exec()
  46. return
  47. }
  48. func UpdateEnglishReportEmailCounts(reportCode string) (err error) {
  49. o := orm.NewOrmUsingDB("rddp")
  50. sql := `UPDATE english_report SET pv_email = pv_email+1 WHERE report_code = ? `
  51. _, err = o.Raw(sql, reportCode).Exec()
  52. return
  53. }
  54. func GetTrialEnglishReportByCode(reportCode string) (item *EnglishReportDetail, err error) {
  55. o := orm.NewOrmUsingDB("rddp_trial")
  56. sql := `SELECT * FROM english_report WHERE report_code=?`
  57. err = o.Raw(sql, reportCode).QueryRow(&item)
  58. return
  59. }
  60. func UpdateTrialEnglishReportCounts(reportCode string) (err error) {
  61. o := orm.NewOrmUsingDB("rddp_trial")
  62. sql := `UPDATE english_report SET pv = pv+1 WHERE report_code = ? `
  63. _, err = o.Raw(sql, reportCode).Exec()
  64. return
  65. }
  66. func UpdateTrialEnglishReportEmailCounts(reportCode string) (err error) {
  67. o := orm.NewOrmUsingDB("rddp_trial")
  68. sql := `UPDATE english_report SET pv_email = pv_email+1 WHERE report_code = ? `
  69. _, err = o.Raw(sql, reportCode).Exec()
  70. return
  71. }