Compare commits

..

No commits in common. "a414a98a513ba3ea947e85b363a229e3e3cbfeeb" and "a274f085f8cabe2441f9babcc80bd65180a53f4f" have entirely different histories.

4 changed files with 16 additions and 44 deletions

View File

@ -74,16 +74,14 @@ func dealMonth(gid string) {
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
}
// 计算消息总数、中位数、前十位消息总数
var msgCount, medianCount, topTenCount int64
// 计算消息总数、中位数
var msgCount int64
var medianCount int64
for idx, v := range records {
msgCount += v.Count
if idx == (len(records)/2)-1 {
medianCount = v.Count
}
if len(records) > 10 && idx < 10 {
topTenCount += v.Count
}
}
// 计算活跃用户人均消息条数
avgMsgCount := int(float64(msgCount) / float64(len(records)))
@ -92,12 +90,7 @@ func dealMonth(gid string) {
notifyMsgs = append(notifyMsgs, " ")
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ %s本群 %d 位朋友共产生 %d 条发言", monthStr, len(records), msgCount))
if showActivity {
m := fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount)
// 计算前十占比
if topTenCount > 0 {
m += fmt.Sprintf(",前十名占比: %.2f%%", float64(topTenCount)/float64(msgCount)*100)
}
notifyMsgs = append(notifyMsgs, m)
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount))
}
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")

View File

@ -73,16 +73,14 @@ func dealWeek(gid string) {
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
}
// 计算消息总数、中位数、前十位消息总数
var msgCount, medianCount, topTenCount int64
// 计算消息总数、中位数
var msgCount int64
var medianCount int64
for idx, v := range records {
msgCount += v.Count
if idx == (len(records)/2)-1 {
medianCount = v.Count
}
if len(records) > 10 && idx < 10 {
topTenCount += v.Count
}
}
// 计算活跃用户人均消息条数
avgMsgCount := int(float64(msgCount) / float64(len(records)))
@ -91,12 +89,7 @@ func dealWeek(gid string) {
notifyMsgs = append(notifyMsgs, " ")
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 上周本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
if showActivity {
m := fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount)
// 计算前十占比
if topTenCount > 0 {
m += fmt.Sprintf(",前十名占比: %.2f%%", float64(topTenCount)/float64(msgCount)*100)
}
notifyMsgs = append(notifyMsgs, m)
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount))
}
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")

View File

@ -73,16 +73,14 @@ func dealYear(gid string) {
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
}
// 计算消息总数、中位数、前十位消息总数
var msgCount, medianCount, topTenCount int64
// 计算消息总数、中位数
var msgCount int64
var medianCount int64
for idx, v := range records {
msgCount += v.Count
if idx == (len(records)/2)-1 {
medianCount = v.Count
}
if len(records) > 10 && idx < 10 {
topTenCount += v.Count
}
}
// 计算活跃用户人均消息条数
avgMsgCount := int(float64(msgCount) / float64(len(records)))
@ -99,12 +97,7 @@ func dealYear(gid string) {
notifyMsgs = append(notifyMsgs, " ")
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 去年本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
if showActivity {
m := fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount)
// 计算前十占比
if topTenCount > 0 {
m += fmt.Sprintf(",前十名占比: %.2f%%", float64(topTenCount)/float64(msgCount)*100)
}
notifyMsgs = append(notifyMsgs, m)
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount))
}
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")

View File

@ -75,16 +75,14 @@ func dealYesterday(gid string) {
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
}
// 计算消息总数、中位数、前十位消息总数
var msgCount, medianCount, topTenCount int64
// 计算消息总数、中位数
var msgCount int64
var medianCount int64
for idx, v := range records {
msgCount += v.Count
if idx == (len(records)/2)-1 {
medianCount = v.Count
}
if len(records) > 10 && idx < 10 {
topTenCount += v.Count
}
}
// 计算活跃用户人均消息条数
avgMsgCount := int(float64(msgCount) / float64(len(records)))
@ -93,12 +91,7 @@ func dealYesterday(gid string) {
notifyMsgs = append(notifyMsgs, " ")
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 昨日本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
if showActivity {
m := fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount)
// 计算前十占比
if topTenCount > 0 {
m += fmt.Sprintf(",前十名占比: %.2f%%", float64(topTenCount)/float64(msgCount)*100)
}
notifyMsgs = append(notifyMsgs, m)
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d中位数: %d", activity, avgMsgCount, medianCount))
}
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")