修复一些bug,添加pushPlus群组推送
This commit is contained in:
parent
8dd3cb5732
commit
4cf5c09b0f
|
@ -30,6 +30,7 @@ type Config struct {
|
||||||
PushPlus struct {
|
PushPlus struct {
|
||||||
Enable bool `json:"enable" yaml:"enable" mapstructure:"enable"`
|
Enable bool `json:"enable" yaml:"enable" mapstructure:"enable"`
|
||||||
Token string `json:"token" yaml:"token" mapstructure:"token"`
|
Token string `json:"token" yaml:"token" mapstructure:"token"`
|
||||||
|
Topic string `json:"topic" yaml:"topic" mapstructure:"topic"`
|
||||||
} `json:"push_plus" yaml:"push_plus" mapstructure:"push_plus"`
|
} `json:"push_plus" yaml:"push_plus" mapstructure:"push_plus"`
|
||||||
} `json:"push" yaml:"push" mapstructure:"push"`
|
} `json:"push" yaml:"push" mapstructure:"push"`
|
||||||
TG struct {
|
TG struct {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/johlanse/study_xxqg/conf"
|
||||||
"github.com/johlanse/study_xxqg/utils"
|
"github.com/johlanse/study_xxqg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ func (p *PushPlus) Init() func(id string, kind, message string) {
|
||||||
"content": data,
|
"content": data,
|
||||||
"template": "markdown",
|
"template": "markdown",
|
||||||
"channel": "wechat",
|
"channel": "wechat",
|
||||||
|
"topic": conf.GetConfig().Push.PushPlus.Topic,
|
||||||
}).Post("http://www.pushplus.plus/send")
|
}).Post("http://www.pushplus.plus/send")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err.Error())
|
log.Errorln(err.Error())
|
||||||
|
|
|
@ -186,6 +186,8 @@ func getExpiredUser() gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
level := ctx.GetInt("level")
|
||||||
|
if level == 1 {
|
||||||
ctx.JSON(200, Resp{
|
ctx.JSON(200, Resp{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "",
|
Message: "",
|
||||||
|
@ -193,6 +195,22 @@ func getExpiredUser() gin.HandlerFunc {
|
||||||
Success: true,
|
Success: true,
|
||||||
Error: "",
|
Error: "",
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
var myFaileUser []*model.User
|
||||||
|
for _, user := range failUser {
|
||||||
|
if user.Token == ctx.GetString("token") {
|
||||||
|
myFaileUser = append(myFaileUser, user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.JSON(200, Resp{
|
||||||
|
Code: 200,
|
||||||
|
Message: "",
|
||||||
|
Data: myFaileUser,
|
||||||
|
Success: true,
|
||||||
|
Error: "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue