You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
534 B
34 lines
534 B
2 years ago
|
package message
|
||
|
|
||
|
import "message-demo/global"
|
||
|
|
||
|
var Messages = make(map[string]Message, 0)
|
||
|
|
||
|
type Message interface {
|
||
|
Send(body MessageBody)
|
||
|
}
|
||
|
|
||
|
type MessageBody struct {
|
||
|
Title string
|
||
|
Content string
|
||
|
}
|
||
|
|
||
|
// GetSupport 获取支持
|
||
|
func GetSupport() Message {
|
||
|
initBark()
|
||
|
initMail()
|
||
|
//key := "bark"
|
||
|
key := global.GLO_CONF.MsgType
|
||
|
return Messages[key]
|
||
|
}
|
||
|
|
||
|
// Enabled 是否启用
|
||
|
func Enabled() bool {
|
||
|
return global.GLO_CONF.MsgEnabled
|
||
|
}
|
||
|
|
||
|
// Register 注册
|
||
|
func Register(name string, message Message) {
|
||
|
Messages[name] = message
|
||
|
}
|