node.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package model
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. "github.com/gogf/gf/v2/os/gtime"
  5. "github.com/gogf/gf/v2/util/gmeta"
  6. )
  7. type NodeCreateInput struct {
  8. Name string
  9. Host string
  10. Port int
  11. Url string
  12. PingType int
  13. UrlStatus int
  14. }
  15. type NodeConfigAndEditCreateInput struct {
  16. ServerId int
  17. SshCom string
  18. SshPass string
  19. SshUser string
  20. }
  21. // node_count //node_loos
  22. type PingConfigEditInput struct {
  23. NodeDie int
  24. NodeCount int
  25. NodeLoos int
  26. PingTime int
  27. PingName string
  28. NodeRecover int
  29. }
  30. type NodeEditInput struct {
  31. Id int
  32. Name string
  33. Host string
  34. Port int
  35. Url string
  36. UrlRecover string
  37. PingType int
  38. UrlStatus int
  39. IsNotice int
  40. }
  41. type NodeDelInput struct {
  42. Id int
  43. }
  44. type NodeUpdateInput struct {
  45. ServerId int
  46. NodeMs int
  47. }
  48. // EntityNodePingLog PINGLOGN表
  49. type EntityNodePingLog struct {
  50. gmeta.Meta `orm:"table:pinglog"`
  51. Serverid int `json:"serverid"`
  52. Avgdelay string `json:"avgdelay"` // 平均延迟
  53. CreateAt *gtime.Time `json:"createAt" description:"创建时间"` // 创建时间
  54. }
  55. // EntityNodeInfo 组合模型,用户信息
  56. type EntityNodeInfo struct {
  57. gmeta.Meta `orm:"table:node"`
  58. Id int `orm:"id" json:"id"`
  59. Name string `orm:"name"`
  60. Host string `orm:"host"`
  61. }
  62. // 组合模型,用户信息
  63. type UserItem struct {
  64. Node *EntityNodeInfo
  65. PingLog []*EntityNodePingLog
  66. }
  67. type EntityNodeConfigInfo struct {
  68. g.Meta `orm:"table:nodeconfig"`
  69. Id interface{} // ID主键
  70. Serverid interface{} // 服务器ID
  71. Sshcommand interface{} // 服务器执行命令
  72. Sshpassword interface{} // 服务器密码
  73. Sshusername interface{} // ssh账号
  74. }
  75. type NodeInfo struct {
  76. g.Meta `orm:"table:node"`
  77. Id int `json:"id" description:"ID主键自动添加"` // ID主键自动添加
  78. Name string `json:"name" description:"服务器名称"` // 服务器名称
  79. Host string `json:"host" description:"服务器IP"` // 服务器IP
  80. Port int `json:"port" description:"服务器端口"` // 服务器端口
  81. Url string `json:"url" description:"服务器切换地址"` // 服务器切换地址
  82. UrlRecover string `json:"UrlRecover" description:"服务器恢复地址"` // 服务器切换地址
  83. UpdateAt *gtime.Time `json:"updateAt" description:"更新时间"` // 更新时间
  84. CreateAt *gtime.Time `json:"createAt" description:"创建时间"` // 创建时间
  85. PingType int `json:"pingType" description:"服务器延迟类型 0 icmp 1 tcp"` // 服务器延迟类型 0 icmp 1 tcp
  86. UrlStatus int `json:"urlStatus" description:"用于表示url是否执行完成"` // 用于表示url是否执行完成
  87. NodeMs int `json:"nodeMs" description:"服务器延迟"` // 服务器延迟
  88. UrlCount int `json:"urlCount" description:"用于服务器切换IP执行次数"` // 用于服务器切换IP执行次数
  89. UrlRet string `json:"urlRet" description:"切换服务器放回结果"` // 切换服务器放回结果
  90. IsNotice int `json:"isNotice" description:"是否通知到电报"` // 是否通知到电报
  91. }
  92. // 组合模型,用户信息
  93. type NodeConfigItem struct {
  94. Node *NodeInfo
  95. NodeConfig []*EntityNodeConfigInfo
  96. }