task.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package model
  2. // TaskStateJump dm task jump a queue
  3. const (
  4. TaskRegexLen = 250 // dm task regex max length
  5. // dm task state
  6. TaskReviewPass = int32(2)
  7. TaskStateRun = int32(3)
  8. TaskStateFailed = int32(4)
  9. )
  10. // TaskList dm task info list
  11. type TaskList struct {
  12. Page *PageInfo
  13. Result []*TaskInfo `json:"result"`
  14. }
  15. // TaskView .
  16. type TaskView struct {
  17. ID int64 `json:"id"`
  18. Title string `json:"title"`
  19. Creator string `json:"creator"`
  20. Reviewer string `json:"reviewer"`
  21. Regex string `json:"regex"`
  22. KeyWords string `json:"keywords"`
  23. IPs string `json:"ips"`
  24. Mids string `json:"mids"`
  25. Cids string `json:"cids"`
  26. Start string `json:"start"`
  27. End string `json:"end"`
  28. QCount int64 `json:"qcount"` //查询总数
  29. Tcount int64 `json:"tcount"` //删除总数
  30. State int32 `json:"state"`
  31. Result string `json:"-"`
  32. Ctime string `json:"ctime"`
  33. Mtime string `json:"mtime"`
  34. SubTask *SubTask `json:"sub,omitempty"`
  35. }
  36. // SubTask .
  37. type SubTask struct {
  38. ID int64 `json:"id"`
  39. Operation int32 `json:"operation"`
  40. Rate int32 `json:"rate"`
  41. Tcount int64 `json:"tcount"` //删除总数
  42. Start string `json:"start"`
  43. End string `json:"end"`
  44. }
  45. // TaskInfo dm task info
  46. type TaskInfo struct {
  47. ID int64 `json:"id"`
  48. Title string `json:"title"`
  49. Creator string `json:"creator"`
  50. Reviewer string `json:"reviewer"`
  51. State int32 `json:"state"`
  52. Result string `json:"result"`
  53. Ctime string `json:"ctime"`
  54. Mtime string `json:"mtime"`
  55. }
  56. // TaskListArg .
  57. type TaskListArg struct {
  58. Creator string `form:"creator"`
  59. Reviewer string `form:"reviewer"`
  60. Title string `form:"title"`
  61. State int32 `form:"state" default:"-1"`
  62. Ctime string `form:"ctime"`
  63. Pn int64 `form:"pn" default:"1" validate:"gt=0"`
  64. Ps int64 `form:"ps" default:"50" validate:"gt=0"`
  65. }
  66. // AddTaskArg .
  67. type AddTaskArg struct {
  68. Creator string
  69. Title string `form:"title" validate:"required"`
  70. Regex string `form:"regex"`
  71. KeyWords string `form:"keywords"`
  72. IPs string `form:"ips"`
  73. Mids string `form:"mids"`
  74. Cids string `form:"cids"`
  75. Start string `form:"start" validate:"required"`
  76. End string `form:"end" validate:"required"`
  77. State int32 `form:"state" default:"0" validate:"gte=0"`
  78. Operation int32 `form:"operation" default:"-1" `
  79. OpTime string `form:"operation_time"`
  80. OpRate int32 `form:"operation_rate" default:"100" validate:"gt=0"`
  81. }
  82. // ReviewTaskArg .
  83. type ReviewTaskArg struct {
  84. ID int64 `form:"id" validate:"required,gte=0"`
  85. State int32 `form:"state" validate:"required,gte=0"`
  86. Reviewer string
  87. Topic string
  88. }
  89. // EditTasksStateArg .
  90. type EditTasksStateArg struct {
  91. IDs string `form:"ids" validate:"required"`
  92. State int32 `form:"state" validate:"required,gte=0"`
  93. }
  94. // TaskViewArg .
  95. type TaskViewArg struct {
  96. ID int64 `form:"id" validate:"required,gte=0"`
  97. }
  98. // TaskCsvArg .
  99. type TaskCsvArg struct {
  100. ID int64 `form:"id" validate:"required,gte=0"`
  101. }