api: add DisPlayIndex info (#397)

This commit is contained in:
UUBulb 2024-07-28 13:43:28 +08:00 committed by GitHub
parent 5bb7efdeb9
commit 9d96c58ff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,13 +26,14 @@ type CommonResponse struct {
} }
type CommonServerInfo struct { type CommonServerInfo struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Tag string `json:"tag"` Tag string `json:"tag"`
LastActive int64 `json:"last_active"` LastActive int64 `json:"last_active"`
IPV4 string `json:"ipv4"` IPV4 string `json:"ipv4"`
IPV6 string `json:"ipv6"` IPV6 string `json:"ipv6"`
ValidIP string `json:"valid_ip"` ValidIP string `json:"valid_ip"`
DisplayIndex int `json:"display_index"`
} }
// StatusResponse 服务器状态子结构 包含服务器信息与状态信息 // StatusResponse 服务器状态子结构 包含服务器信息与状态信息
@ -141,13 +142,14 @@ func (s *ServerAPIService) GetAllStatus() *ServerStatusResponse {
} }
ipv4, ipv6, validIP := utils.SplitIPAddr(host.IP) ipv4, ipv6, validIP := utils.SplitIPAddr(host.IP)
info := CommonServerInfo{ info := CommonServerInfo{
ID: v.ID, ID: v.ID,
Name: v.Name, Name: v.Name,
Tag: v.Tag, Tag: v.Tag,
LastActive: v.LastActive.Unix(), LastActive: v.LastActive.Unix(),
IPV4: ipv4, IPV4: ipv4,
IPV6: ipv6, IPV6: ipv6,
ValidIP: validIP, ValidIP: validIP,
DisplayIndex: v.DisplayIndex,
} }
res.Result = append(res.Result, &StatusResponse{ res.Result = append(res.Result, &StatusResponse{
CommonServerInfo: info, CommonServerInfo: info,