This commit is contained in:
cdle 2021-08-19 09:38:44 +08:00
parent 199d6743ec
commit 9513957d7c
4 changed files with 9 additions and 27 deletions

View File

@ -1,17 +1,13 @@
package models
func (ck *JdCookie) Push(msg string) {
if Config.QywxKey != "" {
go qywxNotify(&QywxConfig{Content: msg})
}
if Config.TelegramBotToken != "" {
go tgBotNotify(msg)
}
if Config.QQID != 0 {
go SendQQ(Config.QQID, msg)
if ck.PtPin != "" {
go SendQQ(int64(ck.QQ), msg)
}
if ck.PushPlus != "" {
go pushPlus(ck.PushPlus, msg)
go SendTgMsg(ck.Telegram, msg)
} else {
go SendQQ(Config.QQID, msg)
go qywxNotify(&QywxConfig{QywxKey: Config.QywxKey, Content: msg})
go SendTgMsg(Config.TelegramUserID, msg)
}
}

View File

@ -7,6 +7,9 @@ import (
)
func pushPlus(token string, content string) {
if token == "" {
return
}
req := httplib.Post("http://pushplus.hxtrip.com/send")
req.Header("Content-Type", "application/json")
data, _ := json.Marshal(struct {

View File

@ -19,12 +19,6 @@ type QywxNotifyMessage struct {
}
func qywxNotify(c *QywxConfig) {
// if Config.TelegramBotToken == "" {
// }
if c.QywxKey == "" {
c.QywxKey = Config.QywxKey
}
if c.QywxKey == "" {
return
}

View File

@ -38,17 +38,6 @@ func initTgBot() {
}()
}
func tgBotNotify(msg string) {
if b == nil {
return
}
if Config.TelegramUserID == 0 {
logs.Warn("tgbot未绑定用id")
return
}
b.Send(&tb.User{ID: Config.TelegramUserID}, msg)
}
func SendTgMsg(id int, msg string) {
if b == nil || id == 0 {
return