xlogRepo.go 897 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package events
  2. import (
  3. "fwh-toolbox-server/domain"
  4. "fwh-toolbox-server/dto"
  5. "fwh-toolbox-server/networkEvents"
  6. )
  7. type XlogManageInfo = domain.XlogSiteInfo
  8. type XlogManagePage = dto.ResPage[XlogManageInfo]
  9. func GetXlogManageList(page, size uint) XlogManagePage {
  10. infoList := networkEvents.GetConnectList()
  11. infoListLen := uint(len(infoList))
  12. resPage := XlogManagePage{
  13. Data: []XlogManageInfo{},
  14. PageNum: page,
  15. PageSize: size,
  16. Total: infoListLen,
  17. }
  18. if infoListLen == 0 {
  19. return resPage
  20. }
  21. if page < 1 {
  22. return resPage
  23. }
  24. startIndex := (page - 1) * size
  25. endIndex := page * size
  26. if endIndex > infoListLen {
  27. endIndex = infoListLen
  28. }
  29. if endIndex <= startIndex {
  30. return resPage
  31. }
  32. resPage.Data = infoList[startIndex:endIndex]
  33. return resPage
  34. }
  35. func SendXlogCmd(uuid, cmd string) (string, error) {
  36. return networkEvents.SendXlogCmdDate(uuid, []byte(cmd))
  37. }