Merge pull request '✨ 群消息统计新增前十名消息数占比' (#31) from hotfix into main
All checks were successful
BuildImage / build-image (push) Successful in 1m21s
All checks were successful
BuildImage / build-image (push) Successful in 1m21s
Reviewed-on: #31
This commit is contained in:
commit
a414a98a51
@ -74,14 +74,16 @@ func dealMonth(gid string) {
|
|||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算消息总数、中位数
|
// 计算消息总数、中位数、前十位消息总数
|
||||||
var msgCount int64
|
var msgCount, medianCount, topTenCount int64
|
||||||
var medianCount int64
|
|
||||||
for idx, v := range records {
|
for idx, v := range records {
|
||||||
msgCount += v.Count
|
msgCount += v.Count
|
||||||
if idx == (len(records)/2)-1 {
|
if idx == (len(records)/2)-1 {
|
||||||
medianCount = v.Count
|
medianCount = v.Count
|
||||||
}
|
}
|
||||||
|
if len(records) > 10 && idx < 10 {
|
||||||
|
topTenCount += v.Count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 计算活跃用户人均消息条数
|
// 计算活跃用户人均消息条数
|
||||||
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
||||||
@ -90,7 +92,12 @@ func dealMonth(gid string) {
|
|||||||
notifyMsgs = append(notifyMsgs, " ")
|
notifyMsgs = append(notifyMsgs, " ")
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ %s本群 %d 位朋友共产生 %d 条发言", monthStr, len(records), msgCount))
|
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ %s本群 %d 位朋友共产生 %d 条发言", monthStr, len(records), msgCount))
|
||||||
if showActivity {
|
if showActivity {
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d,中位数: %d", activity, avgMsgCount, medianCount))
|
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, "\n🏵 活跃用户排行榜 🏵")
|
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||||
|
|
||||||
|
@ -73,14 +73,16 @@ func dealWeek(gid string) {
|
|||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算消息总数、中位数
|
// 计算消息总数、中位数、前十位消息总数
|
||||||
var msgCount int64
|
var msgCount, medianCount, topTenCount int64
|
||||||
var medianCount int64
|
|
||||||
for idx, v := range records {
|
for idx, v := range records {
|
||||||
msgCount += v.Count
|
msgCount += v.Count
|
||||||
if idx == (len(records)/2)-1 {
|
if idx == (len(records)/2)-1 {
|
||||||
medianCount = v.Count
|
medianCount = v.Count
|
||||||
}
|
}
|
||||||
|
if len(records) > 10 && idx < 10 {
|
||||||
|
topTenCount += v.Count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 计算活跃用户人均消息条数
|
// 计算活跃用户人均消息条数
|
||||||
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
||||||
@ -89,7 +91,12 @@ func dealWeek(gid string) {
|
|||||||
notifyMsgs = append(notifyMsgs, " ")
|
notifyMsgs = append(notifyMsgs, " ")
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 上周本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 上周本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||||
if showActivity {
|
if showActivity {
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d,中位数: %d", activity, avgMsgCount, medianCount))
|
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, "\n🏵 活跃用户排行榜 🏵")
|
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||||
|
|
||||||
|
@ -73,14 +73,16 @@ func dealYear(gid string) {
|
|||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算消息总数、中位数
|
// 计算消息总数、中位数、前十位消息总数
|
||||||
var msgCount int64
|
var msgCount, medianCount, topTenCount int64
|
||||||
var medianCount int64
|
|
||||||
for idx, v := range records {
|
for idx, v := range records {
|
||||||
msgCount += v.Count
|
msgCount += v.Count
|
||||||
if idx == (len(records)/2)-1 {
|
if idx == (len(records)/2)-1 {
|
||||||
medianCount = v.Count
|
medianCount = v.Count
|
||||||
}
|
}
|
||||||
|
if len(records) > 10 && idx < 10 {
|
||||||
|
topTenCount += v.Count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 计算活跃用户人均消息条数
|
// 计算活跃用户人均消息条数
|
||||||
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
||||||
@ -97,7 +99,12 @@ func dealYear(gid string) {
|
|||||||
notifyMsgs = append(notifyMsgs, " ")
|
notifyMsgs = append(notifyMsgs, " ")
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 去年本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 去年本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||||
if showActivity {
|
if showActivity {
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d,中位数: %d", activity, avgMsgCount, medianCount))
|
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, "\n🏵 活跃用户排行榜 🏵")
|
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||||
|
|
||||||
|
@ -75,14 +75,16 @@ func dealYesterday(gid string) {
|
|||||||
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
activity = fmt.Sprintf("%.2f", (float64(len(records))/float64(groupUsers))*100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算消息总数、中位数
|
// 计算消息总数、中位数、前十位消息总数
|
||||||
var msgCount int64
|
var msgCount, medianCount, topTenCount int64
|
||||||
var medianCount int64
|
|
||||||
for idx, v := range records {
|
for idx, v := range records {
|
||||||
msgCount += v.Count
|
msgCount += v.Count
|
||||||
if idx == (len(records)/2)-1 {
|
if idx == (len(records)/2)-1 {
|
||||||
medianCount = v.Count
|
medianCount = v.Count
|
||||||
}
|
}
|
||||||
|
if len(records) > 10 && idx < 10 {
|
||||||
|
topTenCount += v.Count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 计算活跃用户人均消息条数
|
// 计算活跃用户人均消息条数
|
||||||
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
avgMsgCount := int(float64(msgCount) / float64(len(records)))
|
||||||
@ -91,7 +93,12 @@ func dealYesterday(gid string) {
|
|||||||
notifyMsgs = append(notifyMsgs, " ")
|
notifyMsgs = append(notifyMsgs, " ")
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 昨日本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🗣️ 昨日本群 %d 位朋友共产生 %d 条发言", len(records), msgCount))
|
||||||
if showActivity {
|
if showActivity {
|
||||||
notifyMsgs = append(notifyMsgs, fmt.Sprintf("🎭 活跃度: %s%%,人均消息条数: %d,中位数: %d", activity, avgMsgCount, medianCount))
|
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, "\n🏵 活跃用户排行榜 🏵")
|
notifyMsgs = append(notifyMsgs, "\n🏵 活跃用户排行榜 🏵")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user