feat: 接线上行帧分发到 message/identity/presence/group

This commit is contained in:
Nixevol
2026-09-30 08:07:16 +08:00
parent 0efcfbb8b6
commit b8569b0708
5 changed files with 805 additions and 22 deletions
+22
View File
@@ -0,0 +1,22 @@
package presence
// EncodeGetData 把 Get 结果编成 presence.get 的 resp data(items 数组)。
// 未知编号项为 {"id":"...","not_found":true},其余含 id/online/since_ms。
func EncodeGetData(items []StatusItem) map[string]any {
out := make([]map[string]any, 0, len(items))
for _, it := range items {
if it.NotFound {
out = append(out, map[string]any{
"id": it.ID,
"not_found": true,
})
continue
}
out = append(out, map[string]any{
"id": it.ID,
"online": it.Online,
"since_ms": it.SinceMs,
})
}
return map[string]any{"items": out}
}