privilege.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package model
  2. import (
  3. "go-common/app/admin/main/vip/model"
  4. "go-common/library/time"
  5. )
  6. // Privilege info.
  7. type Privilege struct {
  8. ID int64 `json:"id"`
  9. Name string `json:"name"`
  10. Title string `json:"title"`
  11. Explain string `json:"explain"`
  12. Type int8 `json:"type"`
  13. Operator string `json:"operator"`
  14. State int8 `json:"state"`
  15. Deleted int8 `json:"deleted"`
  16. IconURL string `json:"icon_url"`
  17. IconGrayURL string `json:"icon_gray_url"`
  18. Order int64 `json:"order"`
  19. LangType int64 `json:"-"`
  20. Ctime time.Time `json:"ctime"`
  21. Mtime time.Time `json:"mtime"`
  22. }
  23. // PrivilegeResources privilege resources.
  24. type PrivilegeResources struct {
  25. ID int64 `json:"id"`
  26. PID int64 `json:"pid"`
  27. Link string `json:"link"`
  28. ImageURL string `json:"image_url"`
  29. Type int8 `json:"type"`
  30. Ctime time.Time `json:"ctime"`
  31. Mtime time.Time `json:"mtime"`
  32. }
  33. // PrivilegeDetailResp privilege detail resp.
  34. type PrivilegeDetailResp struct {
  35. ID int64 `json:"id"`
  36. Name string `json:"name"`
  37. Title string `json:"title"`
  38. Explain string `json:"explain"`
  39. IconURL string `json:"icon_url"`
  40. Type int8 `json:"type"`
  41. Link string `json:"link"`
  42. ImageURL string `json:"image_url"`
  43. }
  44. // PrivilegeResp privilege resp.
  45. type PrivilegeResp struct {
  46. Name string `json:"name"`
  47. IconURL string `json:"icon_url"`
  48. Type int8 `json:"type"`
  49. }
  50. // PrivilegesResp privileges resp.
  51. type PrivilegesResp struct {
  52. Title string `json:"title"`
  53. List []*PrivilegeResp `json:"list"`
  54. }
  55. // ResourcesType get type by platform.
  56. func ResourcesType(p string) int8 {
  57. if p == "pc" {
  58. return model.WebResources
  59. }
  60. return model.AppResources
  61. }