forked from lxh/go-wxhelper
🎨 逻辑优化
This commit is contained in:
parent
a2d84dea08
commit
64c3c9c78b
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user