1
0
forked from lxh/go-wxhelper

🐛 修复清理不活跃成员的时候会把机器人清理掉的 BUG

This commit is contained in:
李寻欢 2024-07-28 00:58:30 +08:00
parent a50b5b3418
commit 80a010680c

View File

@ -57,10 +57,11 @@ func ClearGroupUser() {
// @param days 需要清理的未活跃的天数
// @return members
func getNeedDeleteMembers(groupId string, days int) (members []entity.GroupUser) {
err := client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", groupId).
err := client.MySQL.Model(&entity.GroupUser{}).
Where("group_id = ?", groupId).
Where("wxid != ?", current.GetRobotInfo().WxId).
Where("is_member IS TRUE").
Where("DATEDIFF( NOW(), last_active ) >= ?", days).
Where("wxid != ?", current.GetRobotInfo().WxId).
Order("last_active DESC").
Find(&members).Error
if err != nil {