node.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. }
  78. type NodeConfigReq struct {
  79. g.Meta `path:"/nodeconfig" tags:"nodeconfig" method:"get" summary:"节点配置请求"`
  80. ServerId int `p:"serverid"`
  81. SshCom string `p:"sshcom"`
  82. SshPass string `p:"sshpass"`
  83. SshUser string `p:"sshuser"`
  84. }
  85. type NodeConfigRes struct {
  86. }