diff --git a/main.go b/main.go index 1aa5ebb..7435866 100644 --- a/main.go +++ b/main.go @@ -123,7 +123,7 @@ var ( func init() { _, err := os.Stat(`./config/`) if err != nil { - os.Mkdir("./config/", 0666) //nolint:errcheck + _ = os.Mkdir("./config/", 0666) return } } @@ -161,7 +161,7 @@ func main() { log.Infoln(fmt.Sprintf("已开启wechat公众号配置,监听地址: ==》 %v:%v", config.Web.Host, config.Web.Port)) h.HandleFunc("/wx", push.HandleWechat) } - if config.Web.Enable || config.Wechat.Enable { + if config.Web.Enable || config.Wechat.Enable || config.QQ.Enable { err := http.ListenAndServe(fmt.Sprintf("%s:%d", config.Web.Host, config.Web.Port), h) if err != nil { return diff --git a/model/user.go b/model/user.go index 8a84855..1d879f7 100644 --- a/model/user.go +++ b/model/user.go @@ -88,7 +88,7 @@ func QueryByPushID(pushID string) ([]*User, error) { result []*User ) _ = engine.Ping() - err := engine.Where("status=? and push_id=?", 1, pushID).Find(users) + err := engine.Where("status=? and push_id=?", 1, pushID).Find(&users) if err != nil { return users, err } diff --git a/push/push.go b/push/push.go index bc62a75..f40f76c 100644 --- a/push/push.go +++ b/push/push.go @@ -53,7 +53,14 @@ func GetPush(config conf.Config) func(id string, kind string, message string) { log.Infoln("已配置qq推送") pushs = append(pushs, func(id, kind, message string) { e := &Event{qq: qq} - e.sendPrivateMsg(conf.GetConfig().QQ.SuperUser, message) + if kind == "flush" { + e.sendPrivateMsg(conf.GetConfig().QQ.SuperUser, message) + } else { + if log.GetLevel() == log.DebugLevel { + e.sendPrivateMsg(conf.GetConfig().QQ.SuperUser, message) + } + } + }) } pushs = append(pushs, func(id, kind, message string) { diff --git a/push/qq.go b/push/qq.go index 321d6e0..43dfb12 100644 --- a/push/qq.go +++ b/push/qq.go @@ -148,7 +148,7 @@ func qqStudy(event *Event, args []string) { } -func qqGetScore(event *Event, args []string) { +func qqGetScore(event *Event, _ []string) { users, err := model.Query() if err != nil { event.Send(err.Error())