setting.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package model
  2. // DefaultPrivacy default privacy.
  3. var (
  4. PcyBangumi = "bangumi"
  5. PcyTag = "tags"
  6. PcyFavVideo = "fav_video"
  7. PcyCoinVideo = "coins_video"
  8. PcyGroup = "groups"
  9. PcyGame = "played_game"
  10. PcyChannel = "channel"
  11. PcyUserInfo = "user_info"
  12. PcyLikeVideo = "likes_video"
  13. DefaultPrivacy = map[string]int{
  14. PcyBangumi: 1,
  15. PcyTag: 1,
  16. PcyFavVideo: 1,
  17. PcyCoinVideo: 1,
  18. PcyGroup: 1,
  19. PcyGame: 1,
  20. PcyChannel: 1,
  21. PcyUserInfo: 1,
  22. PcyLikeVideo: 1,
  23. }
  24. DefaultIndexOrder = []*IndexOrder{
  25. {ID: 1, Name: "我的稿件"},
  26. {ID: 8, Name: "我的专栏"},
  27. {ID: 7, Name: "我的频道"},
  28. {ID: 2, Name: "我的收藏夹"},
  29. {ID: 3, Name: "订阅番剧"},
  30. {ID: 4, Name: "订阅标签"},
  31. {ID: 5, Name: "最近投币的视频"},
  32. {ID: 6, Name: "我的圈子"},
  33. {ID: 9, Name: "我的相簿"},
  34. {ID: 21, Name: "公告"},
  35. {ID: 22, Name: "直播间"},
  36. {ID: 23, Name: "个人资料"},
  37. {ID: 24, Name: "官方活动"},
  38. {ID: 25, Name: "最近玩过的游戏"},
  39. }
  40. IndexOrderMap = indexOrderMap()
  41. )
  42. // Setting setting struct.
  43. type Setting struct {
  44. Privacy map[string]int `json:"privacy"`
  45. IndexOrder []*IndexOrder `json:"index_order"`
  46. }
  47. // Privacy privacy struct.
  48. type Privacy struct {
  49. Privacy string `json:"privacy"`
  50. Status int `json:"status"`
  51. }
  52. // IndexOrder index order struct.
  53. type IndexOrder struct {
  54. ID int `json:"id"`
  55. Name string `json:"name"`
  56. }
  57. func indexOrderMap() map[int]string {
  58. data := make(map[int]string, len(DefaultIndexOrder))
  59. for _, v := range DefaultIndexOrder {
  60. data[v.ID] = v.Name
  61. }
  62. return data
  63. }