oplog.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 int32 `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. // InfocResult data model for infoc type operation log storing in hbase
  20. type InfocResult struct {
  21. Oid string `json:"oid"`
  22. Type string `json:"type"`
  23. Subject string `json:"subject"`
  24. CurrentVal string `json:"current_val"`
  25. OperationTime string `json:"operation_time"`
  26. OperatorType string `json:"operator_type"`
  27. Operator string `json:"operator"`
  28. Source string `json:"source"`
  29. Remark string `json:"remark"`
  30. }
  31. // Source enum integer value
  32. type Source int
  33. // Source enum definition list
  34. const (
  35. _ Source = iota
  36. SourceManager
  37. SourceUp
  38. SourcePlayer
  39. )
  40. // String returns the Source enmu description
  41. func (source Source) String() string {
  42. var text string
  43. switch source {
  44. case SourceManager:
  45. text = "运营后台"
  46. case SourceUp:
  47. text = "创作中心"
  48. case SourcePlayer:
  49. text = "播放器"
  50. default:
  51. log.Warn("String() Unknow Source, warn(%v)")
  52. text = "未知来源"
  53. }
  54. return text
  55. }
  56. // OperatorType enum integer value
  57. type OperatorType int
  58. // OperatorType enum definition list
  59. const (
  60. _ OperatorType = iota
  61. OperatorAdmin
  62. OperatorMember
  63. OperatorSystem
  64. )
  65. // String returns the Source enmu description
  66. func (opType OperatorType) String() string {
  67. var text string
  68. switch opType {
  69. case OperatorAdmin:
  70. text = "管理员"
  71. case OperatorMember:
  72. text = "用户"
  73. case OperatorSystem:
  74. text = "系统"
  75. default:
  76. log.Warn("String() Unknow Source, warn(%v)")
  77. text = "未知来源"
  78. }
  79. return text
  80. }