优化首页指标展示并修复群唯一用户统计

变更项:

1. 修复首页卡片等高问题,统一用户信息与右侧指标区高度,统一热门用户/群组/插件卡片高度。

2. 首页新增三个分析指标:新增用户数、群渗透率、群健康分,并完成前端数据绑定。

3. 优化仪表盘摘要接口,新增 new_users、avg_group_penetration、group_health_score 返回字段。

4. 修复 t_group_stats.unique_users 统计口径,改为按 group_id+plugin_name+command+user_id 去重统计,避免跨群串数据。

5. 新增 t_group_command_user_stats 表结构及索引,并补充到 init.sql。
This commit is contained in:
liuwei
2026-04-15 17:19:38 +08:00
parent b37396db50
commit d472b1523b
3 changed files with 169 additions and 12 deletions

View File

@@ -232,6 +232,27 @@ create or replace index idx_group_id
create or replace index idx_last_used_at
on message_archive.t_group_stats (last_used_at);
create or replace table message_archive.t_group_command_user_stats
(
id bigint auto_increment
primary key,
group_id varchar(50) not null comment '群组ID',
plugin_name varchar(50) not null comment '插件名称',
command varchar(50) not null comment '触发命令',
user_id varchar(50) not null comment '用户ID',
first_used_at datetime not null comment '首次触发时间',
last_used_at datetime not null comment '最近触发时间',
constraint uk_group_plugin_command_user
unique (group_id, plugin_name, command, user_id)
)
comment '群命令用户去重追踪表';
create or replace index idx_group_plugin_command
on message_archive.t_group_command_user_stats (group_id, plugin_name, command);
create or replace index idx_group_command_user_last_used
on message_archive.t_group_command_user_stats (last_used_at);
create or replace table message_archive.t_plugin_point_config
(
id int auto_increment