feat: 接线上行帧分发到 message/identity/presence/group
This commit is contained in:
@@ -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}
|
||||
}
|
||||
Reference in New Issue
Block a user