notice

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MulanPSL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BitHostAlarm      = iota //温度告警
	BitEnclosureAlarm        //围栏告警

	HostAlarm      = "hostAlarm"
	EnclosureAlarm = "enclosureAlarm"
)

定义告警类型

View Source
const (
	Alarm  = 1
	Common = 2
)
View Source
const (
	DistNone     = iota
	DistSms      = 1 //短信
	DistEmail    = 2 //邮件
	DistWechat   = 3 //微信
	DistDingDing = 4 //钉钉
	DistVoice    = 5 //语音
	DistApp      = 6 //APP
	DistSmsEmail = 7 //短信+邮件
)

定义渠道类型

View Source
const (
	ConfigEmail = "email"
	ConfigSms   = "sms"
)

渠道对象字段

View Source
const (
	DeviceTemplate = `` /* 138-byte string literal not displayed */

)

模板定义

View Source
const NoticeListKey = "notice.list.key"

定义通知队列key值

Variables

View Source
var AlarmTitles = map[int]string{
	BitHostAlarm:      "主机告警",
	BitEnclosureAlarm: "围栏告警",
}

定义告警对应前端的标识

告警标识映射

定义渠道配置对象

View Source
var DistConfigContrast = map[string]int{
	ConfigEmail: DistEmail,
	ConfigSms:   DistSms,
}

定义渠道对象映射渠道

Functions

func DeviceTemplateConvert

func DeviceTemplateConvert(template string, productName, deviceNickName, deviceName, content string, now *gtime.Time) string

DeviceTemplateConvert 设备模板内容转换

Types

type DistConfigEmail

type DistConfigEmail struct {
	Host     string `json:"host"`
	Port     string `json:"port"`
	Nickname string `json:"nickname"`
	Password string `json:"password"`
	Username string `json:"username"`
}

定义渠道配置数据结构

type DistConfigSms

type DistConfigSms struct {
	Operate string `json:"operate"`
	Tencent Tencent
}

type MessageRuleConfig

type MessageRuleConfig struct {
	Channel         int      `json:"channel"`         // 通知渠道 1:短信 2:邮件 3:微信 4:钉钉 5:语音 6:APP 7:短信+邮件 8:短信+微信 9:短信+钉钉 10:短信+语音 11:短信+APP 12:邮件+微信 13:邮件+钉钉 14:邮件+语音 15:邮件+APP 16:微信+钉钉 17:微信+语音 18:微信+APP 19:钉钉+语音 20:钉钉+APP 21:语音+APP 22:短信+邮件+微信 23:短信+邮件+钉钉 24:短信+邮件+语音 25:短信+邮件+APP 26:短信+微信+钉钉 27:短信+微信+语音 28:短信+微信+APP 29:短信+钉钉+语音 30:短信+钉钉+APP 31:短信+语音+APP 32:邮件+微信+钉钉 33:邮件+微信+语音 34:邮件+微信+APP 35:邮件+钉钉+语音 36:邮件+钉钉+APP 37:邮件+语音+APP 38:微信+钉钉+语音 39:微信+钉钉+APP 40:微信+语音+APP 41:钉钉+语音+APP 42:短信+邮件+微信+钉钉 43:短信+邮件+微信+语音 44:短信+邮件+微信+APP 45:短信+邮件+钉钉
	NotifyObject    []string `json:"notifyObject"`    // 通知对象,不同的渠道方式处理通知对象的方式不同,短信:手机号,邮件:邮箱,微信:微信号,钉钉:钉钉号,语音:手机号,APP:用户ID
	Count           int      `json:"count"`           // 消息重传发送次数,0表示不重传,默认0次,最大3次
	SameInterval    int      `json:"sameInterval"`    // 在指定时间内,如果有新的消息内容产生,不会再次发送。单位秒,默认1小时。
	ImmediateNotify bool     `json:"immediateNotify"` // 是否立即通知 true:立即通知  false:不立即通知  ,默认false
	Template        string   `json:"template"`        // 模板
	Title           string   `json:"title"`           // 标题
}

通知消息配置定义

type Tencent

type Tencent struct {
	AppId     string `json:"appId"`
	SecretID  string `json:"secretID"`
	SignName  string `json:"signName"`
	SecretKey string `json:"secretKey"`
}

Jump to

Keyboard shortcuts

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