Files
rpc-client/pkg/rpc/system.go

32 lines
581 B
Go

package rpc
import "fmt"
// 系统相关RPC
type System struct{}
// 获取系统位置
func (s *System) GetSystemLocation() (*SystemLocation, error) {
body := map[string]any{
"key": "system_location",
}
result := &Result[SystemLocation]{}
if err := GetRequest().Send("system.get_config", body, result); err != nil {
return nil, err
}
if result.Code != 0 {
return nil, fmt.Errorf("%s", result.Message)
}
return &result.Data, nil
}
var system *System
// 获取系统相关RPC
func GetSystem() *System {
if system == nil {
system = &System{}
}
return system
}