POST /communication/push

向指定用户的所有激活设备发送推送通知。支持按平台(iOS/Android/Web/Desktop)筛选目标设备,自动记录每个Token的发送成功/失败情况。参考:ePrivacy Directive 2002/58/EC、CAN-SPAM Act。

通信服务 `bearerAuth` application/json

请求体

Schema: service-communication/internal/handler/dto.PushRequest

字段类型必填示例约束描述
body string 是 您有一条新消息 内容
title string 是 新消息通知 标题
user_id string 是 usr_abc123 用户ID
channel string 否 ios 渠道
data object 否 数据
device_token string 否 device_token_xxx 设备Token
platform string 否 all enum: `all`, `ios`, `android`, `web`, `desktop` 平台

响应

状态描述Schema
200发送完成,返回成功和失败的Token数量service-communication/internal/handler/dto.PushResultDetailResponse
400请求参数错误dto.SimpleResponse
401未认证或令牌无效dto.SimpleResponse
403无权访问该资源dto.SimpleResponse
404用户或设备不存在dto.SimpleResponse
500服务内部错误dto.SimpleResponse

引用的 Schema

dto.SimpleResponse

字段类型必填示例约束描述
code integer 否
message string 否
timestamp string 否

service-communication/internal/handler/dto.PushResultDetailResponse

字段类型必填示例约束描述
code integer 否
data service-communication/internal/handler/dto.PushResultResponse 否
message string 否
timestamp string 否

service-communication/internal/handler/dto.PushResultResponse

推送发送结果

字段类型必填示例约束描述
sent boolean 否 True
tokens_failed integer 否 0
tokens_sent integer 否 2