修复一些bug,添加pushPlus群组推送

This commit is contained in:
johlanse 2022-10-30 22:41:22 +08:00
parent 8dd3cb5732
commit 4cf5c09b0f
3 changed files with 28 additions and 7 deletions

View File

@ -30,6 +30,7 @@ type Config struct {
PushPlus struct {
Enable bool `json:"enable" yaml:"enable" mapstructure:"enable"`
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" yaml:"push" mapstructure:"push"`
TG struct {

View File

@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/johlanse/study_xxqg/conf"
"github.com/johlanse/study_xxqg/utils"
)
@ -21,6 +22,7 @@ func (p *PushPlus) Init() func(id string, kind, message string) {
"content": data,
"template": "markdown",
"channel": "wechat",
"topic": conf.GetConfig().Push.PushPlus.Topic,
}).Post("http://www.pushplus.plus/send")
if err != nil {
log.Errorln(err.Error())

View File

@ -186,13 +186,31 @@ func getExpiredUser() gin.HandlerFunc {
}
return
}
ctx.JSON(200, Resp{
Code: 200,
Message: "",
Data: failUser,
Success: true,
Error: "",
})
level := ctx.GetInt("level")
if level == 1 {
ctx.JSON(200, Resp{
Code: 200,
Message: "",
Data: failUser,
Success: true,
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: "",
})
}
}
}