page_history_record.go 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "strconv"
  5. "time"
  6. )
  7. type CygxPageHistoryRecord struct {
  8. Id int `orm:"column(id);pk"`
  9. UserId int `description:"用户ID"`
  10. CreateTime time.Time `description:"创建时间"`
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱"`
  13. CompanyId int `description:"公司id"`
  14. CompanyName string `description:"公司名称"`
  15. DetailId string `description:"详情ID"`
  16. ChartPermissionId int `description:"行业ID"`
  17. IndustrialManagementId string `description:"产业ID"`
  18. PageType string `description:"页面类型,纪要:Summary,纪要搜索:SummarySearch,报告:Report,报告搜索:ReportSearch,产业列表:IndustryList,活动:Activit,活动搜索:ActivitSearch,活动详情:ActivitParticulars,报告详情:ReportParticulars,已结束活动:OverActivity"`
  19. Parameter string `description:"参数"`
  20. Router string `description:"路由"`
  21. PageRouter string `description:"前端页面路径"`
  22. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  23. }
  24. type CygxPageHistoryRecordRep struct {
  25. DetailId string `description:"详情ID"`
  26. ChartPermissionId int `description:"行业ID"`
  27. IndustrialManagementId string `description:"产业ID"`
  28. PageType string `description:"页面类型,纪要:Summary,纪要搜索:SummarySearch,报告:Report,报告搜索:ReportSearch,产业列表:IndustryList,活动:Activit,活动搜索:ActivitSearch,活动详情:ActivitParticulars,报告详情:ReportParticulars , 我的日程:MySchedule, 更多标签:LabelMore , 文章复制:ArticleCopy"`
  29. }
  30. type CygxPageHistoryRecordHtgjRep struct {
  31. DetailId string `description:"详情ID"`
  32. ChartPermissionId int `description:"行业ID"`
  33. IndustrialManagementId string `description:"产业ID"`
  34. CompanyCode string `description:"机构编码"`
  35. CompanyName string `description:"机构名称"`
  36. Email string `description:"机构邮箱"`
  37. Sign string `description:"签名"`
  38. }
  39. // 添加
  40. func AddCygxPageHistoryRecord(item *CygxPageHistoryRecord) (lastId int64, err error) {
  41. o := orm.NewOrm()
  42. lastId, err = o.Insert(item)
  43. return
  44. }
  45. type PageRouter struct {
  46. PageRouter string
  47. }
  48. func GetTimeLineRecordCount(userId, industrialManagementId int) (count int, err error) {
  49. o := orm.NewOrm()
  50. sql := `SELECT COUNT(1) AS count FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=` + strconv.Itoa(industrialManagementId) + `'`
  51. err = o.Raw(sql, userId).QueryRow(&count)
  52. return
  53. }
  54. func GetTimeLineRecordItem(userId, industrialManagementId int) (item *CygxPageHistoryRecord, err error) {
  55. o := orm.NewOrm()
  56. sql := `SELECT * FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=` + strconv.Itoa(industrialManagementId) + `' ORDER BY create_time DESC LIMIT 1,1 `
  57. err = o.Raw(sql, userId).QueryRow(&item)
  58. return
  59. }
  60. func GetTimeLineRecordAllCount(userId int, date string) (items []*CygxPageHistoryRecord, err error) {
  61. o := orm.NewOrm()
  62. sql := `SELECT * FROM cygx_page_history_record WHERE user_id=? AND router LIKE '%/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=%' AND create_time > ? ORDER BY id DESC LIMIT 10 `
  63. _, err = o.Raw(sql, userId, date).QueryRows(&items)
  64. return
  65. }