1
0
forked from lxh/go-wxhelper

🐛 Fix a bug.

This commit is contained in:
李寻欢 2023-09-26 15:01:44 +08:00
parent 4b109b238e
commit a4c9346b05

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"go-wechat/client" "go-wechat/client"
"go-wechat/entity" "go-wechat/entity"
"go-wechat/utils"
"log" "log"
"os" "os"
"strings" "strings"
@ -55,7 +54,7 @@ func dealYesterday(gid string) {
var records []record var records []record
err = client.MySQL.Table("t_message AS tm"). err = client.MySQL.Table("t_message AS tm").
Joins("LEFT JOIN t_group_user AS tgu ON tgu.wxid = tm.group_user"). Joins("LEFT JOIN t_group_user AS tgu ON tgu.wxid = tm.group_user AND tm.from_user = tgu.group_id").
Select("tm.group_user", "tgu.nickname", "count( 1 ) AS `count`"). Select("tm.group_user", "tgu.nickname", "count( 1 ) AS `count`").
Where("tm.from_user = ?", gid). Where("tm.from_user = ?", gid).
Where("DATEDIFF(tm.create_at,NOW()) = -1"). Where("DATEDIFF(tm.create_at,NOW()) = -1").
@ -74,5 +73,5 @@ func dealYesterday(gid string) {
notifyMsgs = append(notifyMsgs, " \n请未上榜的群友多多反思。") notifyMsgs = append(notifyMsgs, " \n请未上榜的群友多多反思。")
log.Printf("排行榜: \n%s", strings.Join(notifyMsgs, "\n")) log.Printf("排行榜: \n%s", strings.Join(notifyMsgs, "\n"))
go utils.SendMessage(gid, "", strings.Join(notifyMsgs, "\n")) //go utils.SendMessage(gid, "", strings.Join(notifyMsgs, "\n"))
} }