[优化]大改动,指令下发采用规则链rpc请求

This commit is contained in:
PandaX
2023-10-14 10:00:05 +08:00
parent 42be3b23e4
commit 7c8001a687
54 changed files with 1256 additions and 294 deletions

View File

@@ -0,0 +1,25 @@
package global_model
import (
"errors"
"fmt"
"time"
)
type RpcPayload struct {
Method string `json:"method"`
Params any `json:"params"`
}
// GetRequestResult 处理设备端请求服务端方法
func (rpc RpcPayload) GetRequestResult() (string, error) {
//TODO 此处处理设备的请求参数逻辑
//自己定义请求逻辑
if rpc.Params == "getCurrentTime" {
unix := time.Now().Unix()
msg := fmt.Sprintf("%d", unix)
return msg, nil
}
// 获取属性 ...
return "", errors.New("未获取到请求方法")
}