Files
mindfulness/server/app/features/push_payload.py
2026-03-12 18:02:25 +08:00

27 lines
624 B
Python

from __future__ import annotations
from typing import Any, Optional
def build_home_push_data(
*,
client_user_id: str,
body: str,
scene: str = "push",
content_id: Optional[int] = None,
) -> dict[str, Any]:
"""
构建客户端点击通知后回到 Home 所需的最小 payload。
"""
data: dict[str, Any] = {
"client_user_id": str(client_user_id),
"scene": str(scene),
"target_screen": "home",
"deep_link": "client://home",
"home_text": str(body),
}
if content_id is not None:
data["content_id"] = int(content_id)
return data