fix(gateway): adminListChannels 按平台聚合——bare+kook多个adapter不再拆成多行导致重复账号
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 根因: caps循环把 kook(bare)+kook:fc2048(多账号) 分别append, 每行Accounts都是完整platform账号集→前端显示两个kook且fc2048重复(主人'只点一次创建出两个kook')
- 修: 按platform聚合(hasChannelSummary检查), 同platform只一行(Name=platform), Accounts为整个platform账号集; 保留agent-121删除同步(平台有账号才显示)
- 测试断言: kook:3fc8/conf0 → kook(聚合行) 更新
- 全仓 go build/vet/test绿; 前端无涉
This commit is contained in:
Aska committed 2026-09-07 16:21:49 +08:00
1 parent 0ed7984de3
commit eaca8dc8cc
3 files changed
+14 -8

No files matched your search

+7 -1
View File
@@ -161,7 +161,13 @@ func (s *Server) adminListChannels(w http.ResponseWriter, r *http.Request) {
continue
}
}
sum := ChannelSummary{Name: ch.Name(), Connected: ch.IsConnected()}
// Aggregate by platform: a bare adapter ("kook") and the multi-account
// ones ("kook:fc2048", "kook:conf1") are ONE platform row, so the account
// list is not duplicated into a separate row per in-registry adapter.
if s.hasChannelSummary(out, platform) {
continue
}
sum := ChannelSummary{Name: platform, Connected: ch.IsConnected()}
if accts, ok := accountsByPlatform[platform]; ok && len(accts) > 0 {
sum.Accounts = enrichAccountsWithBot(accts, botByPlatform[platform])
}