🎨 逻辑优化

This commit is contained in:
李寻欢 2024-03-10 07:36:10 +08:00
parent a2d84dea08
commit 64c3c9c78b
4 changed files with 16 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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