parent
9e4be85a01
commit
899e0b766e
4
main.go
4
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
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) {
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue