oplog.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package oplog
  2. import (
  3. "go-common/library/log"
  4. )
  5. // Infoc operation log for administrator
  6. type Infoc struct {
  7. Oid int64 `json:"oid"`
  8. Type int `json:"type"`
  9. DMIds []int64 `json:"dmids"`
  10. Subject string `json:"subject"`
  11. OriginVal string `json:"origin_val"`
  12. CurrentVal string `json:"current_val"`
  13. OperationTime string `json:"optime"`
  14. OperatorType OperatorType `json:"operator_type"`
  15. Operator int64 `json:"operator"`
  16. Source Source `json:"source"`
  17. Remark string `json:"remark"`
  18. }
  19. // Source enum integer value
  20. type Source int
  21. // Source enum definition list
  22. const (
  23. _ Source = iota
  24. SourceManager
  25. SourceUp
  26. SourcePlayer
  27. )
  28. // String returns the Source enmu description
  29. func (source Source) String() string {
  30. var text string
  31. switch source {
  32. case SourceManager:
  33. text = "运营后台"
  34. case SourceUp:
  35. text = "创作中心"
  36. case SourcePlayer:
  37. text = "播放器"
  38. default:
  39. log.Warn("String() Unknow Source, warn(%+v)", int(source))
  40. text = "未知来源"
  41. }
  42. return text
  43. }
  44. // OperatorType enum integer value
  45. type OperatorType int
  46. // OperatorType enum definition list
  47. const (
  48. _ OperatorType = iota
  49. OperatorAdmin
  50. OperatorMember
  51. OperatorUp
  52. OperatorSystem
  53. )
  54. // String returns the Source enmu description
  55. func (opType OperatorType) String() string {
  56. var text string
  57. switch opType {
  58. case OperatorAdmin:
  59. text = "管理员"
  60. case OperatorMember:
  61. text = "用户"
  62. case OperatorUp:
  63. text = "UP主"
  64. case OperatorSystem:
  65. text = "系统"
  66. default:
  67. log.Warn("String() Unknow Source, warn(%+v)", int(opType))
  68. text = "未知来源"
  69. }
  70. return text
  71. }