规则链结构优化

This commit is contained in:
XM-GO
2023-08-25 17:41:59 +08:00
parent fac575ac7b
commit e436f3b7ad
37 changed files with 254 additions and 157 deletions

View File

@@ -23,16 +23,16 @@ func (f rpcRespondFactory) Create(id string, meta Metadata) (Node, error) {
return decodePath(meta, node)
}
func (n *rpcRespondNode) Handle(msg message.Message) error {
func (n *rpcRespondNode) Handle(msg *message.Message) error {
successLableNode := n.GetLinkedNode("Success")
failureLableNode := n.GetLinkedNode("Failure")
RequestId := n.RequestId
if RequestId == 0 {
RequestId = int(msg.GetMetadata().GetKeyValue("requestId").(float64))
RequestId = int(msg.Metadata.GetValue("requestId").(float64))
}
var datas = mqtt.RpcPayload{
Method: msg.GetMsg()["method"].(string),
Params: msg.GetMsg()["params"],
Method: msg.Msg.GetValue("method").(string),
Params: msg.Msg.GetValue("params"),
}
rpc := &mqtt.RpcRequest{Client: global.MqttClient, RequestId: RequestId}
err := rpc.RespondTpc(datas)