x
This commit is contained in:
parent
199d6743ec
commit
9513957d7c
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user