parent
9e4be85a01
commit
899e0b766e
4
main.go
4
main.go
|
@ -123,7 +123,7 @@ var (
|
||||||
func init() {
|
func init() {
|
||||||
_, err := os.Stat(`./config/`)
|
_, err := os.Stat(`./config/`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Mkdir("./config/", 0666) //nolint:errcheck
|
_ = os.Mkdir("./config/", 0666)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ func main() {
|
||||||
log.Infoln(fmt.Sprintf("已开启wechat公众号配置,监听地址: ==》 %v:%v", config.Web.Host, config.Web.Port))
|
log.Infoln(fmt.Sprintf("已开启wechat公众号配置,监听地址: ==》 %v:%v", config.Web.Host, config.Web.Port))
|
||||||
h.HandleFunc("/wx", push.HandleWechat)
|
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)
|
err := http.ListenAndServe(fmt.Sprintf("%s:%d", config.Web.Host, config.Web.Port), h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func QueryByPushID(pushID string) ([]*User, error) {
|
||||||
result []*User
|
result []*User
|
||||||
)
|
)
|
||||||
_ = engine.Ping()
|
_ = 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 {
|
if err != nil {
|
||||||
return users, err
|
return users, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,14 @@ func GetPush(config conf.Config) func(id string, kind string, message string) {
|
||||||
log.Infoln("已配置qq推送")
|
log.Infoln("已配置qq推送")
|
||||||
pushs = append(pushs, func(id, kind, message string) {
|
pushs = append(pushs, func(id, kind, message string) {
|
||||||
e := &Event{qq: qq}
|
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) {
|
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()
|
users, err := model.Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
event.Send(err.Error())
|
event.Send(err.Error())
|
||||||
|
|
Loading…
Reference in New Issue