fix 规则链错误

This commit is contained in:
XM-GO
2023-09-02 10:11:14 +08:00
parent 7719897b24
commit b008b1b4bf
3 changed files with 5 additions and 5 deletions

View File

@@ -24,9 +24,8 @@ func (r *RuleChainApi) GetNodeLabels(rc *restfulx.ReqCtx) {
func (r *RuleChainApi) RuleChainTest(rc *restfulx.ReqCtx) {
code := restfulx.QueryParam(rc, "code")
instance, _ := rule_engine.NewRuleChainInstance([]byte(code))
newMessage := message.NewMessage()
newMessage.SetMetadata(message.NewMetadata())
instance.StartRuleChain(context.Background(), newMessage)
msg := message.NewMessage("1", message.TelemetryMes, message.Msg{"temperature": 60.4, "humidity": 32.5}, message.Metadata{})
instance.StartRuleChain(context.Background(), msg)
rc.ResData = []map[string]interface{}{}
}