1
0
mirror of https://github.com/fumiama/tienyik.git synced 2026-06-04 23:10:26 +08:00
Files
tienyik/api/cdserv/client.go
2025-10-31 23:20:46 +08:00

33 lines
864 B
Go

package cdserv
import (
"github.com/fumiama/tienyik/hcli"
"github.com/fumiama/tienyik/internal/hson"
"github.com/fumiama/tienyik/internal/textio"
)
type GlobalSwitches struct {
BodyMsgEType []string `json:"bodyMsgEType"`
PasswordRulesEnable bool `json:"passwordRulesEnable"`
}
type ResponseGetServData struct {
GlobalSwitches GlobalSwitches `json:"globalSwitches"`
ServerNodeId string `json:"serverNodeId"`
Timestamp int64 `json:"timestamp"`
NetAccessType int `json:"netAccessType"`
}
func (r *ResponseGetServData) SetClient(cli *hcli.Client) {
cli.Servernode = r.ServerNodeId
}
func GetServData() (*ResponseGetServData, error) {
resp, err := hcli.NoClient.Get(textio.API())
if err != nil {
return nil, err
}
defer resp.Body.Close()
return hson.Unmarshal[*ResponseGetServData](nil, resp.Body)
}