article_comment.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. IndustryId int `description:"产业id"`
  15. CreateTime time.Time `description:"创建时间"`
  16. Mobile string `description:"手机号"`
  17. Email string `description:"邮箱"`
  18. CompanyId int `description:"公司id"`
  19. CompanyName string `description:"公司名称"`
  20. Content string `description:"内容"`
  21. Title string `description:"标题"`
  22. }
  23. // 添加留言
  24. func AddArticleComment(item *CygxArticleComment) (lastId int64, err error) {
  25. o := orm.NewOrm()
  26. lastId, err = o.Insert(item)
  27. return
  28. }
  29. type AddCygxArticleCommentReq struct {
  30. ArticleId int `description:"文章id"`
  31. Content string `description:"内容"`
  32. }
  33. // 我的留言列表
  34. func GetCommentList(userId int) (items []*CygxArticleComment, err error) {
  35. o := orm.NewOrm()
  36. sql := `SELECT
  37. *
  38. FROM
  39. cygx_article_comment AS c
  40. WHERE
  41. user_id = ? ORDER BY c.create_time DESC`
  42. _, err = o.Raw(sql, userId).QueryRows(&items)
  43. return
  44. }
  45. type CygxArticleCommentResp struct {
  46. Id int `orm:"column(id);pk" description:"留言id"`
  47. UserId int `description:"用户id"`
  48. ArticleId int `description:"文章id"`
  49. IndustryId int `description:"产业id"`
  50. ActivityId int `description:"活动id"`
  51. CreateTime time.Time `description:"创建时间"`
  52. Mobile string `description:"手机号"`
  53. Email string `description:"邮箱"`
  54. CompanyId int `description:"公司id"`
  55. CompanyName string `description:"公司名称"`
  56. Content string `description:"内容"`
  57. Title string `description:"标题"`
  58. RedirectType int `description:"跳转类型 1文章 2活动 3产业资源包"`
  59. IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
  60. IsRoadShow bool `description:"是否是路演精华"`
  61. }
  62. type CygxCommentListResp struct {
  63. List []*CygxArticleCommentResp
  64. }