Compare commits
No commits in common. "8bac050a028349b1193ed4b66b7599037772b7b0" and "0f7cf5515d84f7409334a63b55cf4970222d3954" have entirely different histories.
8bac050a02
...
0f7cf5515d
@ -60,15 +60,12 @@ func dealMonth(gid string) {
|
|||||||
|
|
||||||
// 查询群成员总数
|
// 查询群成员总数
|
||||||
var groupUsers int64
|
var groupUsers int64
|
||||||
err = client.MySQL.Model(&entity.GroupUser{}).
|
err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error
|
||||||
Where("group_id = ?", gid).
|
|
||||||
Where("is_member IS TRUE").
|
|
||||||
Count(&groupUsers).Error
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
||||||
}
|
}
|
||||||
// 计算活跃度
|
// 计算活跃度
|
||||||
showActivity := err == nil && groupUsers > 0
|
showActivity := err != nil && groupUsers > 0
|
||||||
activity := "0.00"
|
activity := "0.00"
|
||||||
if groupUsers > 0 {
|
if groupUsers > 0 {
|
||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
|
@ -59,15 +59,12 @@ func dealWeek(gid string) {
|
|||||||
|
|
||||||
// 查询群成员总数
|
// 查询群成员总数
|
||||||
var groupUsers int64
|
var groupUsers int64
|
||||||
err = client.MySQL.Model(&entity.GroupUser{}).
|
err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error
|
||||||
Where("group_id = ?", gid).
|
|
||||||
Where("is_member IS TRUE").
|
|
||||||
Count(&groupUsers).Error
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
||||||
}
|
}
|
||||||
// 计算活跃度
|
// 计算活跃度
|
||||||
showActivity := err == nil && groupUsers > 0
|
showActivity := err != nil && groupUsers > 0
|
||||||
activity := "0.00"
|
activity := "0.00"
|
||||||
if groupUsers > 0 {
|
if groupUsers > 0 {
|
||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
|
@ -59,15 +59,12 @@ func dealYear(gid string) {
|
|||||||
|
|
||||||
// 查询群成员总数
|
// 查询群成员总数
|
||||||
var groupUsers int64
|
var groupUsers int64
|
||||||
err = client.MySQL.Model(&entity.GroupUser{}).
|
err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error
|
||||||
Where("group_id = ?", gid).
|
|
||||||
Where("is_member IS TRUE").
|
|
||||||
Count(&groupUsers).Error
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
||||||
}
|
}
|
||||||
// 计算活跃度
|
// 计算活跃度
|
||||||
showActivity := err == nil && groupUsers > 0
|
showActivity := err != nil && groupUsers > 0
|
||||||
activity := "0.00"
|
activity := "0.00"
|
||||||
if groupUsers > 0 {
|
if groupUsers > 0 {
|
||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
|
@ -61,15 +61,12 @@ func dealYesterday(gid string) {
|
|||||||
|
|
||||||
// 查询群成员总数
|
// 查询群成员总数
|
||||||
var groupUsers int64
|
var groupUsers int64
|
||||||
err = client.MySQL.Model(&entity.GroupUser{}).
|
err = client.MySQL.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Count(&groupUsers).Error
|
||||||
Where("group_id = ?", gid).
|
|
||||||
Where("is_member IS TRUE").
|
|
||||||
Count(&groupUsers).Error
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
log.Printf("查询群成员总数失败, 错误信息: %v", err)
|
||||||
}
|
}
|
||||||
// 计算活跃度
|
// 计算活跃度
|
||||||
showActivity := err == nil && groupUsers > 0
|
showActivity := err != nil && groupUsers > 0
|
||||||
activity := "0.00"
|
activity := "0.00"
|
||||||
if groupUsers > 0 {
|
if groupUsers > 0 {
|
||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
|
Loading…
Reference in New Issue
Block a user