diff --git a/tasks/watergroup/month.go b/tasks/watergroup/month.go index fd7703b..bcd99d1 100644 --- a/tasks/watergroup/month.go +++ b/tasks/watergroup/month.go @@ -60,7 +60,10 @@ func dealMonth(gid string) { // 查询群成员总数 var groupUsers int64 - err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error + err = client.MySQL.Model(&entity.GroupUser{}). + Where("group_id = ?", gid). + Where("is_member IS TRUE"). + Count(&groupUsers).Error if err != nil { log.Printf("查询群成员总数失败, 错误信息: %v", err) } diff --git a/tasks/watergroup/week.go b/tasks/watergroup/week.go index a27298a..6598ca2 100644 --- a/tasks/watergroup/week.go +++ b/tasks/watergroup/week.go @@ -59,7 +59,10 @@ func dealWeek(gid string) { // 查询群成员总数 var groupUsers int64 - err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error + err = client.MySQL.Model(&entity.GroupUser{}). + Where("group_id = ?", gid). + Where("is_member IS TRUE"). + Count(&groupUsers).Error if err != nil { log.Printf("查询群成员总数失败, 错误信息: %v", err) } diff --git a/tasks/watergroup/year.go b/tasks/watergroup/year.go index 255fa8c..3d07bcf 100644 --- a/tasks/watergroup/year.go +++ b/tasks/watergroup/year.go @@ -59,7 +59,10 @@ func dealYear(gid string) { // 查询群成员总数 var groupUsers int64 - err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error + err = client.MySQL.Model(&entity.GroupUser{}). + Where("group_id = ?", gid). + Where("is_member IS TRUE"). + Count(&groupUsers).Error if err != nil { log.Printf("查询群成员总数失败, 错误信息: %v", err) } diff --git a/tasks/watergroup/yesterday.go b/tasks/watergroup/yesterday.go index 77adc5a..697f721 100644 --- a/tasks/watergroup/yesterday.go +++ b/tasks/watergroup/yesterday.go @@ -61,7 +61,10 @@ func dealYesterday(gid string) { // 查询群成员总数 var groupUsers int64 - err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error + err = client.MySQL.Model(&entity.GroupUser{}). + Where("group_id = ?", gid). + Where("is_member IS TRUE"). + Count(&groupUsers).Error if err != nil { log.Printf("查询群成员总数失败, 错误信息: %v", err) }