scrm-go

article_models.go 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package models
  2. type ArticleCategory struct{
  3. //对应数据库中的字段
  4. IMenuId int64 `gorm:"column:id" json:"id" form:"id"`
  5. Name string `gorm:"column:name" json:"name" form:"Name"`
  6. Order int64 `gorm:"column:order" json:"order" form:"order"`
  7. Status int64 `gorm:"column:status" json:"status" form:"status"`
  8. Summary string `gorm:"column:summary" json:"summary" form:"summary"`
  9. Type int64 `gorm:"column:type" json:"type" form:"type"`
  10. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
  11. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  12. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  13. Num int64 `gorm:"column:num" json:"num" form:"num"`
  14. }
  15. func (ArticleCategory) TableName() string {
  16. return "sgj_patient_articles_menu"
  17. }
  18. type Articles struct {
  19. ID int64 `gorm:"column:id" json:"id"`
  20. Title string `gorm:"column:title" json:"title"`
  21. Summary string `gorm:"column:summary" json:"summary"`
  22. Content string `gorm:"column:content" json:"content"`
  23. Type int `gorm:"column:type" json:"type"`
  24. Num int `gorm:"column:num" json:"num"`
  25. Mtime int64 `gorm:"column:mtime" json:"mtime"`
  26. Ctime int64 `gorm:"column:ctime" json:"ctime"`
  27. ClassId int64 `gorm:"column:class_id" json:"class_id"`
  28. Author string `gorm:"column:author" json:"author"`
  29. Status int `gorm:"column:status" json:"status"`
  30. Reason string `gorm:"column:reason" json:"reason"`
  31. StarNum int `gorm:"column:star_num" json:"star_num"`
  32. CommentNum int `gorm:"column:comment_num" json:"comment_num"`
  33. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id"`
  34. ArticleStatus int64 `gorm:"column:article_status" json:"article_status"`
  35. Imgs string `gorm:"column:imgs" json:"imgs"`
  36. VideoUrl string `gorm:"column:video_url" json:"video_url"`
  37. Cover string `gorm:"-" json:"cover"`
  38. PublicTime string `gorm:"-" json:"publicTime"`
  39. Comments []Comment `gorm:"ForeignKey:ArticleId"`
  40. ArticleId int64 `gorm:"-"`
  41. }
  42. func (Articles) TableName() string {
  43. return "sgj_patient_articles"
  44. }
  45. type Comment struct {
  46. ID int64 `gorm:"column:id" json:"id"`
  47. ArticleId int64 `gorm:"column:article_id" json:"article_id"`
  48. CommentUserId int64 `gorm:"column:comment_user_id" json:"comment_user_id"`
  49. ParentId int64 `gorm:"column:parent_id" json:"parent_id"`
  50. Content string `gorm:"column:content" json:"content"`
  51. Ctime int64 `gorm:"column:ctime" json:"ctime"`
  52. Mtime int64 `gorm:"column:mtime" json:"mtime"`
  53. Status int64 `gorm:"column:status" json:"status"`
  54. StarNum int64 `gorm:"column:star_num" json:"star_num"`
  55. CommentNum int64 `gorm:"column:comment_num" json:"comment_num"`
  56. CommentId int64 `gorm:"column:comment_id" json:"comment_id"`
  57. CommentUserName string `gorm:"column:comment_user_name" json:"comment_user_name"`
  58. CommentUserAvater string `gorm:"column:comment_user_avater" json:"comment_user_avater"`
  59. CommentTime string `gorm:"-" json:"commentTime"`
  60. Article Articles
  61. Parent Parents
  62. }
  63. type Parents struct {
  64. ID int64 `gorm:"-" json:"id"`
  65. ArticleId int64 `gorm:"-" json:"article_id"`
  66. CommentUserId int64 `gorm:"-" json:"comment_user_id"`
  67. ParentId int64 `gorm:"-" json:"parent_id"`
  68. Content string `gorm:"-" json:"content"`
  69. Ctime int64 `gorm:"-" json:"ctime"`
  70. Mtime int64 `gorm:"-" json:"mtime"`
  71. Status int64 `gorm:"-" json:"status"`
  72. StarNum int64 `gorm:"-" json:"star_num"`
  73. CommentNum int64 `gorm:"-" json:"comment_num"`
  74. CommentId int64 `gorm:"-" json:"comment_id"`
  75. CommentUserName string `gorm:"-" json:"comment_user_name"`
  76. CommentUserAvater string `gorm:"-" json:"comment_user_avater"`
  77. CommentTime string `gorm:"-" json:"commentTime"`
  78. }
  79. func (Comment) TableName() string {
  80. return "sgj_patient_articles_comment"
  81. }