Compare commits

...

1 Commits

Author SHA1 Message Date
exinglang 94a2c04398 fix(推送): 支持小米测试推送模式 2026-07-28 22:25:57 +08:00
3 changed files with 3 additions and 0 deletions
+1
View File
@@ -104,6 +104,7 @@ class Settings(BaseSettings):
XIAOMI_PUSH_APP_SECRET: str = ""
XIAOMI_PUSH_SEND_ENDPOINT: str = "https://api.xmpush.xiaomi.com/v3/message/regid"
XIAOMI_PUSH_MODE: int = 1 # 0=正式推送,1=测试推送
XIAOMI_PUSH_CHANNEL_ID: str = ""
XIAOMI_PUSH_TEMPLATE_ID: str = ""
XIAOMI_PUSH_TEMPLATE_TITLE: str = ""
+1
View File
@@ -424,6 +424,7 @@ def _send_xiaomi(token: str, title: str, body: str, extras: dict[str, str]) -> d
"payload": json.dumps(extras, ensure_ascii=False),
"pass_through": "0",
"notify_type": "-1",
"pushMode": settings.XIAOMI_PUSH_MODE,
"time_to_live": str(settings.PUSH_TIME_TO_LIVE_SEC * 1000),
}
# 点击落地:带 notificationId 的消息中心推送 → notify_effect=2 + intent_uri,MiPush 直接打开
+1
View File
@@ -48,6 +48,7 @@ def test_xiaomi_accessibility_payload(monkeypatch) -> None:
body = captured["data"]
assert body["registration_id"] == "xm-regid"
assert body["restricted_package_name"] == "com.jishisongfu.shaguabijia"
assert body["pushMode"] == 1
assert json.loads(body["payload"]) == {"type": "accessibility_disabled"}
assert "extra.channel_id" not in body