/communication/push-tokens
为当前租户下的指定用户注册设备推送令牌(iOS APNs / Android FCM / Web Push / Desktop),用于后续推送通知发送。相同Token重复注册会自动停用旧记录,确保每个Token在库中唯一且最新。参考:ePrivacy Directive 2002/58/EC、CAN-SPAM Act。
请求体
Schema: service-communication/internal/handler/dto.CreatePushTokenRequest
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
platform |
string |
是 | ios |
enum: `ios`, `android`, `web`, `desktop` | |
token |
string |
是 | device_token_xxx |
||
user_id |
string |
是 | usr_abc123 |
||
device_id |
string |
否 | iPhone15-001 |
响应
| 状态 | 描述 | Schema |
|---|---|---|
| 201 | 注册成功,返回令牌详情 | service-communication/internal/handler/dto.PushTokenDataResponse |
| 400 | 请求参数错误 | dto.SimpleResponse |
| 401 | 未认证或令牌无效 | dto.SimpleResponse |
| 403 | 无权访问该资源 | dto.SimpleResponse |
| 500 | 服务内部错误 | dto.SimpleResponse |
引用的 Schema
dto.SimpleResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | |||
message |
string |
否 | |||
timestamp |
string |
否 |
service-communication/internal/handler/dto.PushTokenDataResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | |||
data |
service-communication/internal/handler/dto.PushTokenResponse |
否 | |||
message |
string |
否 | |||
timestamp |
string |
否 |
service-communication/internal/handler/dto.PushTokenResponse
推送令牌信息
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
created_at |
string |
否 | 2026-04-15T10:00:00Z |
||
device_id |
string |
否 | iPhone15-001 |
||
id |
string |
否 | pt_abc123 |
||
is_active |
boolean |
否 | True |
||
platform |
string |
否 | ios |
||
user_id |
string |
否 | usr_abc123 |