english_report.go 4.0 KB

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