scrm-go

article_models.go 4.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. Realreadnum int64 `gorm:"column:real_read_num" json:"real_read_num"`
  26. Mtime int64 `gorm:"column:mtime" json:"mtime"`
  27. Ctime int64 `gorm:"column:ctime" json:"ctime"`
  28. ClassId int64 `gorm:"column:class_id" json:"class_id"`
  29. Author string `gorm:"column:author" json:"author"`
  30. Status int `gorm:"column:status" json:"status"`
  31. Reason string `gorm:"column:reason" json:"reason"`
  32. StarNum int `gorm:"column:star_num" json:"star_num"`
  33. CommentNum int `gorm:"column:comment_num" json:"comment_num"`
  34. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id"`
  35. ArticleStatus int64 `gorm:"column:article_status" json:"article_status"`
  36. Imgs string `gorm:"column:imgs" json:"imgs"`
  37. VideoUrl string `gorm:"column:video_url" json:"video_url"`
  38. Cover string `gorm:"-" json:"cover"`
  39. PublicTime string `gorm:"-" json:"publicTime"`
  40. Comments []Comment `gorm:"ForeignKey:ArticleId"`
  41. ArticleId int64 `gorm:"-"`
  42. }
  43. func (Articles) TableName() string {
  44. return "sgj_patient_articles"
  45. }
  46. type Comment struct {
  47. ID int64 `gorm:"column:id" json:"id"`
  48. ArticleId int64 `gorm:"column:article_id" json:"article_id"`
  49. CommentUserId int64 `gorm:"column:comment_user_id" json:"comment_user_id"`
  50. ParentId int64 `gorm:"column:parent_id" json:"parent_id"`
  51. Content string `gorm:"column:content" json:"content"`
  52. Ctime int64 `gorm:"column:ctime" json:"ctime"`
  53. Mtime int64 `gorm:"column:mtime" json:"mtime"`
  54. Status int64 `gorm:"column:status" json:"status"`
  55. StarNum int64 `gorm:"column:star_num" json:"star_num"`
  56. CommentNum int64 `gorm:"column:comment_num" json:"comment_num"`
  57. CommentId int64 `gorm:"column:comment_id" json:"comment_id"`
  58. CommentUserName string `gorm:"column:comment_user_name" json:"comment_user_name"`
  59. CommentUserAvater string `gorm:"column:comment_user_avater" json:"comment_user_avater"`
  60. CommentTime string `gorm:"-" json:"commentTime"`
  61. Article Articles
  62. Parent Parents
  63. }
  64. type Parents struct {
  65. ID int64 `gorm:"-" json:"id"`
  66. ArticleId int64 `gorm:"-" json:"article_id"`
  67. CommentUserId int64 `gorm:"-" json:"comment_user_id"`
  68. ParentId int64 `gorm:"-" json:"parent_id"`
  69. Content string `gorm:"-" json:"content"`
  70. Ctime int64 `gorm:"-" json:"ctime"`
  71. Mtime int64 `gorm:"-" json:"mtime"`
  72. Status int64 `gorm:"-" json:"status"`
  73. StarNum int64 `gorm:"-" json:"star_num"`
  74. CommentNum int64 `gorm:"-" json:"comment_num"`
  75. CommentId int64 `gorm:"-" json:"comment_id"`
  76. CommentUserName string `gorm:"-" json:"comment_user_name"`
  77. CommentUserAvater string `gorm:"-" json:"comment_user_avater"`
  78. CommentTime string `gorm:"-" json:"commentTime"`
  79. }
  80. func (Comment) TableName() string {
  81. return "sgj_patient_articles_comment"
  82. }