中文枚举
This commit is contained in:
@@ -71,7 +71,7 @@ lora_mesh:
|
|||||||
|
|
||||||
# 通知服务配置
|
# 通知服务配置
|
||||||
notify:
|
notify:
|
||||||
primary: "log" # 首选通知渠道: smtp, wechat, lark, log (如果其他渠道未启用,log 会自动成为首选)
|
primary: "日志" # 首选通知渠道: "邮件", "企业微信", "飞书", "日志" (如果其他渠道未启用,"日志" 会自动成为首选)
|
||||||
failureThreshold: 2 # 连续失败多少次后触发广播模式
|
failureThreshold: 2 # 连续失败多少次后触发广播模式
|
||||||
smtp:
|
smtp:
|
||||||
enabled: false # 是否启用 SMTP 邮件通知
|
enabled: false # 是否启用 SMTP 邮件通知
|
||||||
|
|||||||
@@ -5656,7 +5656,7 @@ const docTemplate = `{
|
|||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"description": "Type 指定要测试的通知渠道\n@enum(smtp, wechat, lark, log)",
|
"description": "Type 指定要测试的通知渠道",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/notify.NotifierType"
|
"$ref": "#/definitions/notify.NotifierType"
|
||||||
@@ -6611,14 +6611,12 @@ const docTemplate = `{
|
|||||||
"smtp",
|
"smtp",
|
||||||
"wechat",
|
"wechat",
|
||||||
"lark",
|
"lark",
|
||||||
"sms",
|
|
||||||
"log"
|
"log"
|
||||||
],
|
],
|
||||||
"x-enum-varnames": [
|
"x-enum-varnames": [
|
||||||
"NotifierTypeSMTP",
|
"NotifierTypeSMTP",
|
||||||
"NotifierTypeWeChat",
|
"NotifierTypeWeChat",
|
||||||
"NotifierTypeLark",
|
"NotifierTypeLark",
|
||||||
"NotifierTypeSMS",
|
|
||||||
"NotifierTypeLog"
|
"NotifierTypeLog"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5648,7 +5648,7 @@
|
|||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"description": "Type 指定要测试的通知渠道\n@enum(smtp, wechat, lark, log)",
|
"description": "Type 指定要测试的通知渠道",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/notify.NotifierType"
|
"$ref": "#/definitions/notify.NotifierType"
|
||||||
@@ -6603,14 +6603,12 @@
|
|||||||
"smtp",
|
"smtp",
|
||||||
"wechat",
|
"wechat",
|
||||||
"lark",
|
"lark",
|
||||||
"sms",
|
|
||||||
"log"
|
"log"
|
||||||
],
|
],
|
||||||
"x-enum-varnames": [
|
"x-enum-varnames": [
|
||||||
"NotifierTypeSMTP",
|
"NotifierTypeSMTP",
|
||||||
"NotifierTypeWeChat",
|
"NotifierTypeWeChat",
|
||||||
"NotifierTypeLark",
|
"NotifierTypeLark",
|
||||||
"NotifierTypeSMS",
|
|
||||||
"NotifierTypeLog"
|
"NotifierTypeLog"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1130,9 +1130,7 @@ definitions:
|
|||||||
type:
|
type:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/definitions/notify.NotifierType'
|
- $ref: '#/definitions/notify.NotifierType'
|
||||||
description: |-
|
description: Type 指定要测试的通知渠道
|
||||||
Type 指定要测试的通知渠道
|
|
||||||
@enum(smtp, wechat, lark, log)
|
|
||||||
required:
|
required:
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
@@ -1832,14 +1830,12 @@ definitions:
|
|||||||
- smtp
|
- smtp
|
||||||
- wechat
|
- wechat
|
||||||
- lark
|
- lark
|
||||||
- sms
|
|
||||||
- log
|
- log
|
||||||
type: string
|
type: string
|
||||||
x-enum-varnames:
|
x-enum-varnames:
|
||||||
- NotifierTypeSMTP
|
- NotifierTypeSMTP
|
||||||
- NotifierTypeWeChat
|
- NotifierTypeWeChat
|
||||||
- NotifierTypeLark
|
- NotifierTypeLark
|
||||||
- NotifierTypeSMS
|
|
||||||
- NotifierTypeLog
|
- NotifierTypeLog
|
||||||
info:
|
info:
|
||||||
contact:
|
contact:
|
||||||
|
|||||||
@@ -5,6 +5,5 @@ import "git.huangwc.com/pig/pig-farm-controller/internal/infra/notify"
|
|||||||
// SendTestNotificationRequest 定义了发送测试通知请求的 JSON 结构
|
// SendTestNotificationRequest 定义了发送测试通知请求的 JSON 结构
|
||||||
type SendTestNotificationRequest struct {
|
type SendTestNotificationRequest struct {
|
||||||
// Type 指定要测试的通知渠道
|
// Type 指定要测试的通知渠道
|
||||||
// @enum(smtp, wechat, lark, log)
|
|
||||||
Type notify.NotifierType `json:"type" binding:"required"`
|
Type notify.NotifierType `json:"type" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ type LoraMeshConfig struct {
|
|||||||
|
|
||||||
// NotifyConfig 包含了所有与通知服务相关的配置
|
// NotifyConfig 包含了所有与通知服务相关的配置
|
||||||
type NotifyConfig struct {
|
type NotifyConfig struct {
|
||||||
Primary string `yaml:"primary"` // 首选通知渠道 (e.g., "smtp", "wechat", "lark", "log")
|
Primary string `yaml:"primary"` // 首选通知渠道 (e.g., "邮件", "企业微信", "飞书", "日志")
|
||||||
FailureThreshold int `yaml:"failureThreshold"` // 连续失败多少次后触发广播模式
|
FailureThreshold int `yaml:"failureThreshold"` // 连续失败多少次后触发广播模式
|
||||||
SMTP SMTPConfig `yaml:"smtp"`
|
SMTP SMTPConfig `yaml:"smtp"`
|
||||||
WeChat WeChatConfig `yaml:"wechat"`
|
WeChat WeChatConfig `yaml:"wechat"`
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ type NotifierType string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// NotifierTypeSMTP 表示 SMTP 邮件通知器。
|
// NotifierTypeSMTP 表示 SMTP 邮件通知器。
|
||||||
NotifierTypeSMTP NotifierType = "smtp"
|
NotifierTypeSMTP NotifierType = "邮件"
|
||||||
// NotifierTypeWeChat 表示企业微信通知器。
|
// NotifierTypeWeChat 表示企业微信通知器。
|
||||||
NotifierTypeWeChat NotifierType = "wechat"
|
NotifierTypeWeChat NotifierType = "企业微信"
|
||||||
// NotifierTypeLark 表示飞书通知器。
|
// NotifierTypeLark 表示飞书通知器。
|
||||||
NotifierTypeLark NotifierType = "lark"
|
NotifierTypeLark NotifierType = "飞书"
|
||||||
// NotifierTypeLog 表示日志通知器,作为最终的告警记录渠道。
|
// NotifierTypeLog 表示日志通知器,作为最终的告警记录渠道。
|
||||||
NotifierTypeLog NotifierType = "log"
|
NotifierTypeLog NotifierType = "日志"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AlarmContent 定义了通知的内容
|
// AlarmContent 定义了通知的内容
|
||||||
|
|||||||
Reference in New Issue
Block a user