/communication/push
向指定用户的所有激活设备发送推送通知。支持按平台(iOS/Android/Web/Desktop)筛选目标设备,自动记录每个Token的发送成功/失败情况。参考:ePrivacy Directive 2002/58/EC、CAN-SPAM Act。
Request Body
Schema: dto.PushRequest
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
body |
string |
Yes | 您有一条新消息 |
内容 | |
title |
string |
Yes | 新消息通知 |
标题 | |
user_id |
string |
Yes | usr_abc123 |
用户ID | |
channel |
string |
No | ios |
渠道 | |
data |
object |
No | 数据 | ||
device_token |
string |
No | device_token_xxx |
设备Token | |
platform |
string |
No | all |
enum: `all`, `ios`, `android`, `web`, `desktop` | 平台 |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | 发送完成,返回成功和失败的Token数量 | dto.PushResultDetailResponse |
| 400 | 请求参数错误 | dto.SimpleResponse |
| 401 | 未认证或令牌无效 | dto.SimpleResponse |
| 403 | 无权访问该资源 | dto.SimpleResponse |
| 404 | 用户或设备不存在 | dto.SimpleResponse |
| 500 | 服务内部错误 | dto.SimpleResponse |
Referenced Schemas
dto.PushResultDetailResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
data |
dto.PushResultResponse |
No | |||
message |
string |
No | |||
timestamp |
string |
No |
dto.PushResultResponse
推送发送结果
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
sent |
boolean |
No | True |
||
tokens_failed |
integer |
No | 0 |
||
tokens_sent |
integer |
No | 2 |
dto.SimpleResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
message |
string |
No | |||
timestamp |
string |
No |