node.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package v1
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. "github.com/gogf/gf/v2/os/gcron"
  5. "nodeMonitor/internal/model"
  6. "nodeMonitor/internal/model/entity"
  7. )
  8. type NodeReq struct {
  9. g.Meta `path:"/add" tags:"add" method:"post" summary:"增加节点"`
  10. Name string `p:"name" v:"required#节点名称不能为空"`
  11. Host string `p:"host" v:"required#节点不能为空"`
  12. Port int `p:"port"`
  13. Url string `p:"url"`
  14. PingType int `p:"pingType"`
  15. }
  16. type NodeRes struct {
  17. //g.Meta `mime:"application/json"`
  18. }
  19. type NodeEditReq struct {
  20. g.Meta `path:"/edit" tags:"edit" method:"post" summary:"编辑"`
  21. Id int `p:"id" v:"required#节点ID不能为空"`
  22. Name string `p:"name" v:"required#节点名称不能为空"`
  23. Host string `p:"host" v:"required#节点不能为空"`
  24. Port int `p:"port"`
  25. Url string `p:"url"`
  26. PingType int `p:"pingType"`
  27. UrlStatus int `p:"urlstatus"`
  28. }
  29. type NodeEditRes struct {
  30. }
  31. type NodeDelReq struct {
  32. g.Meta `path:"/del" tags:"del" method:"post" summary:"删除节点"`
  33. Id int `p:"id" v:"required#节点Id不能为空"`
  34. }
  35. type NodeDelRes struct {
  36. //g.Meta `mime:"application/json"`
  37. }
  38. type NodeAllReq struct {
  39. g.Meta `path:"/all" tags:"all" method:"get" summary:"获取全部节点"`
  40. }
  41. type NodeALlRes struct {
  42. g.Meta `mime:"application/json"`
  43. NodeList []*entity.Node `json:"nodeList"`
  44. }
  45. type NodeCronStartReq struct {
  46. g.Meta `path:"/start" tags:"start" method:"post" summary:"开始PING任务"`
  47. StartTime int `p:"startTime"`
  48. }
  49. type NodeCronStartRes struct {
  50. g.Meta `mime:"application/json"`
  51. RetEntry []*gcron.Entry
  52. RetCronCount int
  53. Status bool
  54. }
  55. type NodeCronStopReq struct {
  56. g.Meta `path:"/stop" tags:"stop" method:"post" summary:"停止PING任务"`
  57. Remove bool `p:"remove"`
  58. }
  59. type NodeCronStopRes struct {
  60. g.Meta `mime:"application/json"`
  61. RetCronCount int
  62. Status bool
  63. }
  64. type NodeCronStatusReq struct {
  65. g.Meta `path:"/task" tags:"task" method:"get" summary:"查看任务状态"`
  66. }
  67. type NodeCronStatusRes struct {
  68. g.Meta `mime:"application/json"`
  69. RetEntry []*gcron.Entry
  70. RetCronCount int
  71. }
  72. type NodeStatusReq struct {
  73. g.Meta `path:"/nodestatus" tags:"nodestatus" method:"get" summary:"查看任务状态"`
  74. }
  75. type NodeStatusRes struct {
  76. NodeItme []*model.UserItem
  77. }