Files
PandaX/pkg/rule_engine/nodes/external_send_sms_node.go
2023-10-27 16:13:17 +08:00

38 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package nodes
import (
"pandax/pkg/rule_engine/message"
)
type externalSendSmsNode struct {
bareNode
SecretId string `json:"secretId" yaml:"secretId"`
SecretKey string `json:"secretKey" yaml:"secretKey"`
SdkAppId string `json:"sdkAppId" yaml:"sdkAppId"` //应用Id腾讯 或 签名名称(阿里)
PhoneNumber string `json:"phoneNumber" yaml:"phoneNumber"` //发送到手机号
TemplateId string `json:"templateId" yaml:"templateId"` //短信模板Id
TemplateParam map[string]interface{} `json:"templateParam" yaml:"templateParam"` //模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空*/
}
type externalSendSmsNodeFactory struct{}
func (f externalSendSmsNodeFactory) Name() string { return "SendSmsNode" }
func (f externalSendSmsNodeFactory) Category() string { return NODE_CATEGORY_EXTERNAL }
func (f externalSendSmsNodeFactory) Labels() []string { return []string{"Success", "Failure"} }
func (f externalSendSmsNodeFactory) Create(id string, meta Properties) (Node, error) {
node := &externalSendSmsNode{
bareNode: newBareNode(f.Name(), id, meta, f.Labels()),
}
return decodePath(meta, node)
}
func (n *externalSendSmsNode) Handle(msg *message.Message) error {
n.Debug(msg, message.DEBUGIN, "")
successLabelNode := n.GetLinkedNode("Success")
//failureLabelNode := n.GetLinkedNode("Failure")
n.Debug(msg, message.DEBUGOUT, "")
return successLabelNode.Handle(msg)
}