| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package controllers
- import (
- "fwh-toolbox-server/logger"
- "fwh-toolbox-server/networkEvents"
- )
- type XlogManageInfo = networkEvents.SiteInfo
- type XlogManagePage = ResPage[XlogManageInfo]
- func GetXlogManageList(page, size uint) XlogManagePage {
- infoList := networkEvents.GetConnectList()
- infoListLen := uint(len(infoList))
- resPage := XlogManagePage{
- Data: []XlogManageInfo{},
- PageNum: page,
- PageSize: size,
- Total: infoListLen,
- }
- if infoListLen == 0 {
- return resPage
- }
- if page < 1 {
- return resPage
- }
- startIndex := (page - 1) * size
- endIndex := page * size
- if endIndex > infoListLen {
- endIndex = infoListLen
- }
- if endIndex <= startIndex {
- return resPage
- }
- resPage.Data = infoList[startIndex:endIndex]
- return resPage
- }
- func SendXlogCmd(uuid, cmd string) (string, error) {
- logger.Std.Printf("Send xlog cmd: %s - %s\n", uuid, cmd)
- return networkEvents.SendXlogCmdDate(uuid, []byte(cmd))
- }
|