publish.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package blocked
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // const publish
  6. const (
  7. // ptype.
  8. PublishOfficial = int8(1) // 官方公告
  9. PublishWeekCommunity = int8(2) // 社区周报
  10. PublishFeatureBuild = int8(3) // 功能建设
  11. PublishHotCommunity = int8(4) // 社区热点
  12. // stick_status.
  13. PublishStickON = int8(1) // 置顶
  14. PublishStickOFF = int8(0) // 不置顶
  15. )
  16. // var publish
  17. var (
  18. PTypeDesc = map[int8]string{
  19. PublishOfficial: "官方公告",
  20. PublishWeekCommunity: "社区周报",
  21. PublishFeatureBuild: "功能建设",
  22. PublishHotCommunity: "社区热点",
  23. }
  24. SStatusDesc = map[int8]string{
  25. PublishStickON: "置顶",
  26. PublishStickOFF: "不置顶",
  27. }
  28. )
  29. // Publish is blocked_publish model.
  30. type Publish struct {
  31. ID int64 `gorm:"column:id" json:"id"`
  32. Title string `gorm:"column:title" json:"title"`
  33. SubTitle string `gorm:"column:sub_title" json:"sub_title"`
  34. Type int8 `gorm:"column:ptype" json:"type"`
  35. PublishStatus int8 `gorm:"column:publish_status" json:"publish_status"`
  36. StickStatus int8 `gorm:"column:stick_status" json:"stick_status"`
  37. Status int8 `gorm:"column:status" json:"status"`
  38. Content string `gorm:"column:content" json:"content"`
  39. URL string `gorm:"column:url" json:"url"`
  40. OPID int64 `gorm:"column:oper_id" json:"oper_id"`
  41. ShowTime xtime.Time `gorm:"column:show_time" json:"show_time"`
  42. PublishTypeDesc string `gorm:"-" json:"publish_type_desc"`
  43. PublishStatusDesc string `gorm:"-" json:"publish_status_desc"`
  44. StickStatusDesc string `gorm:"-" json:"stick_status_desc"`
  45. OPName string `gorm:"-" json:"oname"`
  46. CTime xtime.Time `gorm:"column:ctime" json:"-"`
  47. MTime xtime.Time `gorm:"column:mtime" json:"-"`
  48. }
  49. // PublishList is publish list.
  50. type PublishList struct {
  51. Count int `json:"count"`
  52. Order string `json:"order"`
  53. Sort string `json:"sort"`
  54. PN int `json:"pn"`
  55. PS int `json:"ps"`
  56. IDs []int64 `json:"-"`
  57. List []*Publish `json:"list"`
  58. }
  59. // TableName publish tablename
  60. func (*Publish) TableName() string {
  61. return "blocked_publish"
  62. }