mirror of
https://github.com/jackwener/wx-cli.git
synced 2026-10-09 03:15:46 +00:00
feat(unread): 按 chat_type 分类会话,新增 --filter (#9)
Before: wx unread / sessions / history 把公众号、订阅号折叠入口 (brandsessionholder)、折叠群聊(@placeholder_foldgroup)、认证服务号 全归为 is_group=false,与真私聊混在一起。甚至 username 形如 wxid_* 但 实为公众号的条目也完全分不出来。 改动: - 新增 chat_type_of(username, names) helper,输出固定为 group / official_account / folded / private。 - 判据依次:@chatroom → group;brandsessionholder / @placeholder_foldgroup → folded;contact.verify_flag != 0 → official_account(覆盖 wxid_* 伪装为公众号的情况,以及银行/品牌服务号、qqsafe / mphelper 等认证账号); gh_* / biz_* / @* 前缀兜底;其余为 private。 - load_names 顺带读 contact.verify_flag,Names::is_verified 封装查询。 - q_sessions / q_unread / q_history / q_new_messages / q_stats 输出 新增 chat_type 字段,is_group 保留向后兼容并统一由 chat_type 派生。 - wx unread 新增 --filter,clap value_parser 限制可选值为 all / private / group / official / folded,逗号分隔多选,默认 all。 例:wx unread --filter private,group 可过滤公众号与折叠入口。 - SKILL.md / README.md 补充新字段与用法说明。 - .gitignore 补 target/(Rust 项目标配)。 性能:默认 wx unread 的 SQL 与改动前相同(保留 LIMIT)。仅当传入 --filter 时改为全表扫再 Rust 侧过滤,否则 SQL LIMIT 会先把匹配 filter 的条目截断导致漏召。
This commit is contained in:
@@ -66,6 +66,7 @@ async fn async_run() -> Result<()> {
|
||||
map: HashMap::new(),
|
||||
md5_to_uname: HashMap::new(),
|
||||
msg_db_keys: Vec::new(),
|
||||
verify_flags: HashMap::new(),
|
||||
}
|
||||
});
|
||||
let mut names = names_raw;
|
||||
|
||||
Reference in New Issue
Block a user