飞书通知推送基本实现

This commit is contained in:
kercylan98 2023-04-27 19:48:30 +08:00
parent 6216af500f
commit 2c0a6d7adc
3 changed files with 4 additions and 10 deletions

View File

@ -30,11 +30,7 @@ type FeiShu struct {
MsgType string `json:"msg_type"`
}
func (slf *FeiShu) GetTitle() string {
return ""
}
func (slf *FeiShu) GetContent() (string, error) {
func (slf *FeiShu) Format() (string, error) {
data, err := json.Marshal(slf)
if err != nil {
return "", err

View File

@ -2,8 +2,6 @@ package notify
// Notify 通用通知接口定义
type Notify interface {
// GetTitle 获取通知标题
GetTitle() string
// GetContent 获取通知内容
GetContent() (string, error)
// Format 格式化通知内容
Format() (string, error)
}

View File

@ -22,7 +22,7 @@ type FeiShu struct {
}
func (slf *FeiShu) Push(notify notify.Notify) error {
content, err := notify.GetContent()
content, err := notify.Format()
if err != nil {
return err
}