Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
905dab5ab8 | ||
|
|
ddb0db0b6a | ||
|
|
8bac050a02 | ||
|
|
a548af9de2 | ||
|
|
64c3c9c78b |
@@ -60,12 +60,15 @@ 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)
|
||||
}
|
||||
// 计算活跃度
|
||||
showActivity := err != nil && groupUsers > 0
|
||||
showActivity := err == nil && groupUsers > 0
|
||||
activity := "0.00"
|
||||
if groupUsers > 0 {
|
||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||
@@ -80,7 +83,7 @@ func dealMonth(gid string) {
|
||||
notifyMsgs = append(notifyMsgs, " ")
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ %s本群 %d 位朋友共产生 %d 条发言", monthStr, len(records), msgCount))
|
||||
if showActivity {
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%", activity))
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%", activity))
|
||||
}
|
||||
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||
|
||||
|
||||
@@ -59,12 +59,15 @@ 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)
|
||||
}
|
||||
// 计算活跃度
|
||||
showActivity := err != nil && groupUsers > 0
|
||||
showActivity := err == nil && groupUsers > 0
|
||||
activity := "0.00"
|
||||
if groupUsers > 0 {
|
||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||
@@ -79,7 +82,7 @@ func dealWeek(gid string) {
|
||||
notifyMsgs = append(notifyMsgs, " ")
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 上周本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||
if showActivity {
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%", activity))
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%", activity))
|
||||
}
|
||||
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||
|
||||
|
||||
@@ -59,12 +59,15 @@ 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)
|
||||
}
|
||||
// 计算活跃度
|
||||
showActivity := err != nil && groupUsers > 0
|
||||
showActivity := err == nil && groupUsers > 0
|
||||
activity := "0.00"
|
||||
if groupUsers > 0 {
|
||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||
@@ -87,7 +90,7 @@ func dealYear(gid string) {
|
||||
notifyMsgs = append(notifyMsgs, " ")
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 去年本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||
if showActivity {
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%", activity))
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%", activity))
|
||||
}
|
||||
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||
|
||||
|
||||
@@ -61,12 +61,15 @@ 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)
|
||||
}
|
||||
// 计算活跃度
|
||||
showActivity := err != nil && groupUsers > 0
|
||||
showActivity := err == nil && groupUsers > 0
|
||||
activity := "0.00"
|
||||
if groupUsers > 0 {
|
||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||
@@ -81,7 +84,7 @@ func dealYesterday(gid string) {
|
||||
notifyMsgs = append(notifyMsgs, " ")
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 昨日本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||
if showActivity {
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%", activity))
|
||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%", activity))
|
||||
}
|
||||
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user