2021-11-17 09:39:48 +00:00
|
|
|
package push
|
|
|
|
|
|
|
|
import (
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
|
2022-08-03 10:04:52 +00:00
|
|
|
"github.com/johlanse/study_xxqg/conf"
|
2021-11-17 09:39:48 +00:00
|
|
|
)
|
|
|
|
|
2022-07-27 10:21:49 +00:00
|
|
|
func GetPush(config conf.Config) func(kind string, message string) {
|
2021-11-17 09:39:48 +00:00
|
|
|
if config.Push.Ding.Enable {
|
|
|
|
ding := &Ding{
|
|
|
|
Secret: config.Push.Ding.Secret,
|
|
|
|
Token: config.Push.Ding.AccessToken,
|
|
|
|
}
|
2021-11-24 14:05:37 +00:00
|
|
|
log.Infoln("已配置钉钉推送")
|
2021-11-17 09:39:48 +00:00
|
|
|
return ding.Send()
|
2021-11-22 12:07:55 +00:00
|
|
|
} else if config.Push.PushPlus.Enable {
|
2021-11-24 14:05:37 +00:00
|
|
|
log.Infoln("已配置pushplus推送")
|
2021-11-22 12:07:55 +00:00
|
|
|
return (&PushPlus{Token: config.Push.PushPlus.Token}).Init()
|
2021-11-17 09:39:48 +00:00
|
|
|
}
|
|
|
|
return func(kind string, message string) {
|
|
|
|
log.Infoln("")
|
|
|
|
}
|
|
|
|
}
|