node.go 2.5 KB

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