article_comment.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxArticleComment struct {
  7. Id int `orm:"column(id);pk" description:"留言id"`
  8. UserId int `description:"用户id"`
  9. RealName string `description:"用户姓名"`
  10. ArticleId int `description:"文章id"`
  11. ActivityId int `description:"活动id"`
  12. VideoId int `description:"视频id"`
  13. ActivityVoiceId int `description:"活动音频ID"`
  14. AskserieVideoId int `description:" 系列问答视频ID askserie_video_id"`
  15. IndustryId int `description:"产业id"`
  16. CreateTime time.Time `description:"创建时间"`
  17. Mobile string `description:"手机号"`
  18. Email string `description:"邮箱"`
  19. CompanyId int `description:"公司id"`
  20. CompanyName string `description:"公司名称"`
  21. Content string `description:"内容"`
  22. Title string `description:"标题"`
  23. }
  24. // 添加留言
  25. func AddArticleComment(item *CygxArticleComment) (lastId int64, err error) {
  26. o := orm.NewOrm()
  27. lastId, err = o.Insert(item)
  28. return
  29. }
  30. type AddCygxArticleCommentReq struct {
  31. ArticleId int `description:"文章id"`
  32. Content string `description:"内容"`
  33. }
  34. // 我的留言列表
  35. func GetCommentList(userId int) (items []*CygxArticleComment, err error) {
  36. o := orm.NewOrm()
  37. sql := `SELECT
  38. *
  39. FROM
  40. cygx_article_comment AS c
  41. WHERE
  42. user_id = ? ORDER BY c.create_time DESC`
  43. _, err = o.Raw(sql, userId).QueryRows(&items)
  44. return
  45. }
  46. type CygxArticleCommentResp struct {
  47. Id int `orm:"column(id);pk" description:"留言id"`
  48. UserId int `description:"用户id"`
  49. ArticleId int `description:"文章id"`
  50. IndustryId int `description:"产业id"`
  51. ActivityId int `description:"活动id"`
  52. CreateTime time.Time `description:"创建时间"`
  53. Mobile string `description:"手机号"`
  54. Email string `description:"邮箱"`
  55. CompanyId int `description:"公司id"`
  56. CompanyName string `description:"公司名称"`
  57. Content string `description:"内容"`
  58. Title string `description:"标题"`
  59. RedirectType int `description:"跳转类型 1文章 2活动 3产业资源包"`
  60. IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
  61. IsRoadShow bool `description:"是否是路演精华"`
  62. }
  63. type CygxCommentListResp struct {
  64. List []*CygxArticleCommentResp
  65. }
  66. // 通过ID获取详情
  67. func GetArticleCommentById(id int) (item *CygxArticleCommentResp, err error) {
  68. sql := `SELECT * FROM cygx_article_comment WHERE id=? `
  69. err = orm.NewOrm().Raw(sql, id).QueryRow(&item)
  70. return
  71. }
  72. type CygxArticleCommentWxResp struct {
  73. Content string `description:"内容"`
  74. SourceId int `description:"跳转ID"`
  75. RedirectType int `description:"跳转类型 1文章 2活动 3产业资源包"`
  76. }