添加系统相关&节假日相关&用户相关RPC

This commit is contained in:
2025-10-17 15:52:15 +08:00
parent 6429b34a24
commit 25ba002da2
4 changed files with 111 additions and 0 deletions

31
pkg/rpc/system.go Normal file
View File

@@ -0,0 +1,31 @@
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
}