notice

package
v0.5.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

通知中心

用于平台产生的各种告警推送。

Documentation

Index

Constants

View Source
const (
	TextMsgType       = "text"
	LinkMsgType       = "link"
	MarkDownMsgType   = "markdown"
	ActionCardMsgType = "actionCard"
)

Variables

This section is empty.

Functions

func NewtDingNotice

func NewtDingNotice(msgtype string) *dingMsg

钉钉通知消息对象实体获取

Types

type DingActionCard

type DingActionCard struct {
	Msgtype    string `json:"msgtype"`
	ActionCard struct {
		Text           string `json:"text"`
		Title          string `json:"title"`
		BtnOrientation string `json:"btnOrientation"`
		SingleTitle    string `json:"singleTitle"`
		SingleURL      string `json:"singleURL"`
	} `json:"actionCard"`
}
type DingLink struct {
	Msgtype string `json:"msgtype"`
	Link    struct {
		Text       string `json:"text"`
		Title      string `json:"title"`
		PicUrl     string `json:"picUrl"`
		MessageUrl string `json:"messageUrl"`
	} `json:"link"`
}

type DingMarkdown

type DingMarkdown struct {
	Msgtype  string `json:"msgtype"`
	Markdown struct {
		Text  string `json:"text"`
		Title string `json:"title"`
	} `json:"markdown"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

type DingNotice

type DingNotice struct{}

func (*DingNotice) Send

func (d *DingNotice) Send(content string)

type DingText

type DingText struct {
	Msgtype string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

钉钉消息

type Email

type Email struct {
	// ServerHost 邮箱服务器地址,如腾讯企业邮箱为smtp.exmail.qq.com
	ServerHost string
	// ServerPort 邮箱服务器端口,如腾讯企业邮箱为465
	ServerPort int
	// FromEmail 发件人邮箱地址
	FromEmail string
	// FromPasswd 发件人邮箱密码(注意,这里是明文形式),TODO:如果设置成密文?
	FromPasswd string
	// Toers 接收者邮件
	Toers []string
	// CCers 抄送者邮件
	CCers []string
	//这是主题
	Subject string
	//这是正文
	Body string
	// contains filtered or unexported fields
}

func NewEmailNotice

func NewEmailNotice(setters ...EmailOption) (email *Email)

默认邮件通知初始化

func (*Email) Send

func (ep *Email) Send(fields map[string]interface{})

SendEmail body支持html格式字符串

type EmailOption

type EmailOption func(*Email)

func EmailBody

func EmailBody(fields map[string]interface{}) EmailOption

type Message

type Message struct {
	Subject string
	Body    string
	To      []string
}

Message ..

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL