修复微信点击无法学习
This commit is contained in:
johlanse 2022-11-09 08:20:20 +08:00
parent 9e4be85a01
commit 899e0b766e
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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) {

View File

@ -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())