node.go 2.4 KB

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