feat(message_summary): add group overview stats section
This commit is contained in:
@@ -551,6 +551,27 @@ class MessageStorage:
|
||||
logger.error(f"统计消息数量出错: {e}")
|
||||
return 0
|
||||
|
||||
def get_message_stats_by_date_range(self, group_id, start_time: datetime, end_time: datetime) -> Dict:
|
||||
"""获取指定时间范围内的群消息概览统计"""
|
||||
try:
|
||||
stats = self.message_db.get_message_stats_by_date_range(group_id, start_time, end_time)
|
||||
logger.info(
|
||||
f"群 {group_id} 在 {start_time} 至 {end_time} 的消息概览: "
|
||||
f"total={stats.get('total_count', 0)}, participants={stats.get('participant_count', 0)}"
|
||||
)
|
||||
return stats
|
||||
except Exception as e:
|
||||
logger.error(f"获取消息概览统计出错: {e}")
|
||||
return {
|
||||
"total_count": 0,
|
||||
"participant_count": 0,
|
||||
"text_count": 0,
|
||||
"image_count": 0,
|
||||
"video_count": 0,
|
||||
"link_count": 0,
|
||||
"emoji_count": 0,
|
||||
}
|
||||
|
||||
def _format_messages_optimized(self, messages: list, all_contacts: dict) -> str:
|
||||
"""优化的消息格式化方法,减少冗余
|
||||
|
||||
|
||||
Reference in New Issue
Block a user