english_report.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. package models
  2. import (
  3. "time"
  4. "github.com/beego/beego/v2/client/orm"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. )
  7. type EnglishReport struct {
  8. Id int `orm:"column(id)" description:"报告Id"`
  9. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  10. ClassifyIdFirst int `description:"一级分类id"`
  11. ClassifyNameFirst string `description:"一级分类名称"`
  12. ClassifyIdSecond int `description:"二级分类id"`
  13. ClassifyNameSecond string `description:"二级分类名称"`
  14. Title string `description:"标题"`
  15. Abstract string `description:"摘要"`
  16. Author string `description:"作者"`
  17. Frequency string `description:"频度"`
  18. CreateTime string `description:"创建时间"`
  19. ModifyTime time.Time `description:"修改时间"`
  20. State int `description:"1:未发布,2:已发布"`
  21. PublishTime time.Time `description:"发布时间"`
  22. Stage int `description:"期数"`
  23. Content string `description:"内容"`
  24. VideoUrl string `description:"音频文件URL"`
  25. VideoName string `description:"音频文件名称"`
  26. VideoPlaySeconds string `description:"音频播放时长"`
  27. VideoSize string `description:"音频文件大小,单位M"`
  28. ContentSub string `description:"内容前两个章节"`
  29. ReportCode string `description:"报告唯一编码"`
  30. Pv int `description:"Pv"`
  31. PvEmail int `description:"邮箱PV"`
  32. UvEmail uint `description:"邮箱UV"` //分享邮箱的UV
  33. EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"`
  34. Overview string `description:"英文概述部分"`
  35. KeyTakeaways string `description:"关键点"`
  36. FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
  37. AdminId int `description:"创建者账号"`
  38. AdminRealName string `description:"创建者姓名"`
  39. }
  40. type AddEnglishReportReq struct {
  41. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  42. ClassifyIdFirst int `description:"一级分类id"`
  43. ClassifyNameFirst string `description:"一级分类名称"`
  44. ClassifyIdSecond int `description:"二级分类id"`
  45. ClassifyNameSecond string `description:"二级分类名称"`
  46. Title string `description:"标题"`
  47. Abstract string `description:"摘要"`
  48. Author string `description:"作者"`
  49. Frequency string `description:"频度"`
  50. State int `description:"状态:1:未发布,2:已发布"`
  51. Content string `description:"内容"`
  52. CreateTime string `description:"创建时间"`
  53. Overview string `description:"英文概述部分"`
  54. }
  55. type AddEnglishReportResp struct {
  56. ReportId int64 `description:"报告id"`
  57. ReportCode string `description:"报告code"`
  58. }
  59. type EditEnglishReportReq struct {
  60. ReportId int64 `description:"报告id"`
  61. ClassifyIdFirst int `description:"一级分类id"`
  62. ClassifyNameFirst string `description:"一级分类名称"`
  63. ClassifyIdSecond int `description:"二级分类id"`
  64. ClassifyNameSecond string `description:"二级分类名称"`
  65. Title string `description:"标题"`
  66. Abstract string `description:"摘要"`
  67. Author string `description:"作者"`
  68. Frequency string `description:"频度"`
  69. State int `description:"状态:1:未发布,2:已发布"`
  70. Content string `description:"内容"`
  71. CreateTime string `description:"创建时间"`
  72. Overview string `description:"英文概述部分"`
  73. }
  74. type EditEnglishReportFromPolicyReq struct {
  75. ReportId int64 `description:"报告id"`
  76. Title string `description:"标题"`
  77. Abstract string `description:"摘要"`
  78. Author string `description:"作者"`
  79. Frequency string `description:"频度"`
  80. CreateTime string `description:"创建时间"`
  81. //Overview string `description:"英文概述部分"`
  82. }
  83. type EditEnglishReportResp struct {
  84. ReportId int64 `description:"报告id"`
  85. ReportCode string `description:"报告code"`
  86. }
  87. type ElasticEnglishReportDetail struct {
  88. Id string `description:"报告id或者线上路演Id"`
  89. ReportId int `description:"报告id"`
  90. VideoId int `description:"线上路演Id"`
  91. ClassifyIdFirst int `description:"一级分类id"`
  92. ClassifyNameFirst string `description:"一级分类名称"`
  93. ClassifyIdSecond int `description:"二级分类id"`
  94. ClassifyNameSecond string `description:"二级分类名称"`
  95. StageStr string `description:"报告期数"`
  96. Title string `description:"标题"`
  97. Abstract string `description:"摘要"`
  98. Author string `description:"作者"`
  99. Frequency string `description:"频度"`
  100. PublishState int `description:"状态:1:未发布,2:已发布"`
  101. BodyContent string `description:"内容"`
  102. ContentSub string `description:"前两段内容"`
  103. CreateTime string `description:"创建时间"`
  104. PublishTime string `description:"发布时间"`
  105. ReportCode string `description:"报告唯一编码"`
  106. Overview string `description:"英文概述部分"`
  107. }
  108. type EnglishReportDetail struct {
  109. Id int `orm:"column(id)" description:"报告Id"`
  110. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  111. ClassifyIdFirst int `description:"一级分类id"`
  112. ClassifyNameFirst string `description:"一级分类名称"`
  113. ClassifyIdSecond int `description:"二级分类id"`
  114. ClassifyNameSecond string `description:"二级分类名称"`
  115. Title string `description:"标题"`
  116. Abstract string `description:"摘要"`
  117. Author string `description:"作者"`
  118. Frequency string `description:"频度"`
  119. CreateTime string `description:"创建时间"`
  120. ModifyTime string `description:"修改时间"`
  121. State int `description:"1:未发布,2:已发布"`
  122. PublishTime string `description:"发布时间"`
  123. Stage int `description:"期数"`
  124. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  125. ReportCode string `description:"报告唯一编码"`
  126. Content string `description:"内容"`
  127. VideoUrl string `description:"音频文件URL"`
  128. VideoName string `description:"音频文件名称"`
  129. VideoPlaySeconds string `description:"音频播放时长"`
  130. ContentSub string `description:"内容前两个章节"`
  131. Pv int `description:"Pv"`
  132. Overview string `description:"英文概述部分"`
  133. FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
  134. KeyTakeaways string `description:"关键点"`
  135. }
  136. type EnglishReportList struct {
  137. Id int `description:"报告Id"`
  138. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  139. ClassifyIdFirst int `description:"一级分类id"`
  140. ClassifyNameFirst string `description:"一级分类名称"`
  141. ClassifyIdSecond int `description:"二级分类id"`
  142. ClassifyNameSecond string `description:"二级分类名称"`
  143. Title string `description:"标题"`
  144. Abstract string `description:"摘要"`
  145. Author string `description:"作者"`
  146. Frequency string `description:"频度"`
  147. CreateTime string `description:"创建时间"`
  148. ModifyTime time.Time `description:"修改时间"`
  149. State int `description:"1:未发布,2:已发布"`
  150. PublishTime string `description:"发布时间"`
  151. Stage int `description:"期数"`
  152. Content string `description:"内容"`
  153. VideoUrl string `description:"音频文件URL"`
  154. VideoName string `description:"音频文件名称"`
  155. VideoPlaySeconds string `description:"音频播放时长"`
  156. ContentSub string `description:"内容前两个章节"`
  157. ReportCode string `description:"报告唯一编码"`
  158. Pv int `description:"Pv"`
  159. ShareUrl string `description:"分享url"`
  160. PvEmail int `description:"邮箱PV"`
  161. EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"`
  162. EmailAuth bool `description:"是否有权限群发邮件"`
  163. EmailHasFail bool `description:"是否存在邮件发送失败的记录"`
  164. CanEdit bool `description:"是否可编辑"`
  165. Editor string `description:"编辑人"`
  166. FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
  167. AdminId int `description:"创建者账号"`
  168. AdminRealName string `description:"创建者姓名"`
  169. }
  170. type EnglishReportListResp struct {
  171. List []*EnglishReportList
  172. Paging *paging.PagingItem `description:"分页数据"`
  173. }
  174. // 删除报告
  175. func DeleteEnglishReport(reportIds int) (err error) {
  176. o := orm.NewOrmUsingDB("rddp")
  177. sql := ` DELETE FROM english_report WHERE id =? `
  178. _, err = o.Raw(sql, reportIds).Exec()
  179. return
  180. }
  181. type EnglishClassifyList struct {
  182. Id int `orm:"column(id);pk"`
  183. ClassifyName string `description:"分类名称"`
  184. Sort int `description:"排序"`
  185. ParentId int `description:"父级分类id"`
  186. CreateTime time.Time `description:"创建时间"`
  187. ModifyTime time.Time `description:"修改时间"`
  188. ClassifyLabel string `description:"分类标签"`
  189. ShowType int `description:"展示类型:1-列表 2-专栏"`
  190. IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
  191. ClassifyType int `description:"分类类型:0英文报告,1英文线上路演"`
  192. Child []*EnglishClassify
  193. }
  194. type EnglishClassifyListResp struct {
  195. List []*EnglishClassifyList
  196. Paging *paging.PagingItem `description:"分页数据"`
  197. }
  198. // Update 更新
  199. func (item *EnglishReport) Update(cols []string) (err error) {
  200. o := orm.NewOrmUsingDB("rddp")
  201. _, err = o.Update(item, cols...)
  202. return
  203. }
  204. // ModifyEnglishReportAuthor 更改英文报告作者
  205. func ModifyEnglishReportAuthor(condition string, pars []interface{}, authorName string) (count int, err error) {
  206. //产品权限
  207. oRddp := orm.NewOrmUsingDB("rddp")
  208. sql := `UPDATE english_report set author = ? WHERE 1=1 `
  209. if condition != "" {
  210. sql += condition
  211. }
  212. err = oRddp.Raw(sql, authorName, pars).QueryRow(&count)
  213. return
  214. }
  215. type EnglishClassify struct {
  216. Id int `orm:"column(id);pk"`
  217. ClassifyName string `description:"分类名称"`
  218. Sort int `description:"排序"`
  219. ParentId int `description:"父级分类id"`
  220. CreateTime time.Time `description:"创建时间"`
  221. ModifyTime time.Time `description:"修改时间"`
  222. ClassifyLabel string `description:"分类标签"`
  223. ShowType int `description:"展示类型:1-列表 2-专栏"`
  224. IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
  225. ClassifyType int `description:"分类类型:0英文报告,1英文线上路演"`
  226. }
  227. func AddEnglishClassify(item *EnglishClassify) (lastId int64, err error) {
  228. o := orm.NewOrmUsingDB("rddp")
  229. lastId, err = o.Insert(item)
  230. return
  231. }
  232. func ModifyEnglishClassify(item *EnglishClassify) (err error) {
  233. o := orm.NewOrmUsingDB("rddp")
  234. sql := `UPDATE english_classify
  235. SET
  236. classify_name = ?,
  237. sort = ?,
  238. parent_id = ?,
  239. modify_time = ?
  240. WHERE id = ? `
  241. _, err = o.Raw(sql, item.ClassifyName, item.Sort, item.ParentId, item.ModifyTime, item.Id).Exec()
  242. return
  243. }
  244. // UpdateClassify 更新分类
  245. func (classifyInfo *EnglishClassify) UpdateEnglishClassify(cols []string) (err error) {
  246. o := orm.NewOrmUsingDB("rddp")
  247. _, err = o.Update(classifyInfo, cols...)
  248. return
  249. }
  250. // UpdateReport 更新英文报告
  251. func (reportInfo *EnglishReport) UpdateReport(cols []string) (err error) {
  252. o := orm.NewOrmUsingDB("rddp")
  253. _, err = o.Update(reportInfo, cols...)
  254. return
  255. }
  256. // MarkEditEnReport 标记编辑英文研报的请求数据
  257. type MarkEditEnReport struct {
  258. ReportId int `description:"研报id"`
  259. Status int `description:"标记状态,1:编辑中,2:编辑完成"`
  260. }
  261. type EnglishClassifyNameParentName struct {
  262. Id int `description:"分类ID"`
  263. ClassifyName string `description:"分类名称"`
  264. Sort int `description:"排序"`
  265. ParentId int `description:"父级分类id"`
  266. CreateTime time.Time `description:"创建时间"`
  267. ModifyTime time.Time `description:"修改时间"`
  268. ClassifyLabel string `description:"分类标签"`
  269. ShowType int `description:"展示类型:1-列表 2-专栏"`
  270. IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
  271. ParentClassifyName string `description:"父级分类名称"`
  272. }
  273. type RSClassifyList []*EnglishClassifyList
  274. func (m RSClassifyList) Len() int {
  275. return len(m)
  276. }
  277. func (m RSClassifyList) Less(i, j int) bool {
  278. return m[i].Sort < m[j].Sort
  279. }
  280. func (m RSClassifyList) Swap(i, j int) {
  281. m[i], m[j] = m[j], m[i]
  282. }
  283. type RSChildClassifyList []*EnglishClassify
  284. func (m RSChildClassifyList) Len() int {
  285. return len(m)
  286. }
  287. func (m RSChildClassifyList) Less(i, j int) bool {
  288. return m[i].Sort < m[j].Sort
  289. }
  290. func (m RSChildClassifyList) Swap(i, j int) {
  291. m[i], m[j] = m[j], m[i]
  292. }