mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
更新
This commit is contained in:
33
pkg/rule_engine/nodes/external_ding_node.go
Normal file
33
pkg/rule_engine/nodes/external_ding_node.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package nodes
|
||||
|
||||
import (
|
||||
"dz-iot-server/rule_engine/message"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type externalDingNode struct {
|
||||
bareNode
|
||||
WebHook string `json:"webHook" yaml:"webHook"`
|
||||
MsgType string `json:"msgType" yaml:"msgType"`
|
||||
Content string `json:"content" yaml:"content"`
|
||||
IsAtAll bool `json:"isAtAll" yaml:"isAtAll"`
|
||||
atMobiles []string `json:"atMobiles" yaml:"atMobiles"`
|
||||
}
|
||||
|
||||
type externalDingNodeFactory struct{}
|
||||
|
||||
func (f externalDingNodeFactory) Name() string { return "ExternalDingNode" }
|
||||
func (f externalDingNodeFactory) Category() string { return NODE_CATEGORY_EXTERNAL }
|
||||
func (f externalDingNodeFactory) Labels() []string { return []string{"Success", "Failure"} }
|
||||
func (f externalDingNodeFactory) Create(id string, meta Metadata) (Node, error) {
|
||||
node := &externalDingNode{
|
||||
bareNode: newBareNode(f.Name(), id, meta, f.Labels()),
|
||||
}
|
||||
return decodePath(meta, node)
|
||||
}
|
||||
|
||||
func (n *externalDingNode) Handle(msg message.Message) error {
|
||||
logrus.Infof("%s handle message '%s'", n.Name(), msg.GetType())
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user