首先是 push_time,不是push-time
其次,确保 URL 是 1.1 协议,1.0 协议的时区是错误的。
最后,push_time 是一个字符串,不是一个 date 对象,并且跟 where ,data 同一层。。
{
"updatedAt": "2016-09-24T09:51:24.198Z",
"where": {
"query": {
"_id": "sx2r9t8VczCAgB5ykAUwHTTBh3bRElFf"
},
"sort": {
"createdAt": 1
}
},
"push-time": null,
"prod": "dev",
"notificationId": "VLQVq8DyY9587aYg",
"createdAt": "2016-09-24T09:51:12.151Z",
"msg": {
"category": "取餐通知",
"sound": "default",
"params": {
"id": "O16032272659668480"
},
"type": "orderDetail",
"alert": "2016-09-24T17:52:29.773Z",
"push_time": "2016-09-24T17:52:29.773Z",
"badge": "Increment",
"expiration_interval": "86400",
"data": {
"badge": "Increment",
"alert": "2016-09-24T17:52:29.773Z",
"sound": "default",
"type": "orderDetail",
"params": {
"id": "O16032272659668480"
},
"category": "取餐通知"
}
},
"successes": 1,
"status": "done",
"devices": 1,
"pushedAt": "2016-09-24T09:51:14.038Z",
"through?": null
}
这样也是不行的
你的 push_time 放到 data 里,贴图里的push_time 出现在 msg 字段,那就是 data。
https://leancloud.cn/1.1/push2
这是我们接口服务使用的url
你自己贴出来的 json 格式化后
{
"msg": {
"category": "\u53d6\u9910\u901a\u77e5",
"sound": "default",
"params": {
"id": "O16032272659668480"
},
"type": "orderDetail",
"alert": "2016-09-24T17:52:29.773Z",
"push_time": "2016-09-24T17:52:29.773Z",
"badge": "Increment",
"expiration_interval": "86400",
"data": {
"badge": "Increment",
"alert": "2016-09-24T17:52:29.773Z",
"sound": "default",
"type": "orderDetail",
"params": {
"id": "O16032272659668480"
},
"category": "\u53d6\u9910\u901a\u77e5"
}
}
}
绝对是层次搞错了,将你发送的请求打印出来,自己检查下吧。
这是request body里面的内容
{ "prod":"prod", "data":{ "badge":"Increment", "expiration_interval":"86400", "alert":"定时测试: Thu Sep 29 15:37:11 CST 2016", "sound":"default", "type":"orderDetail", "params":{ "id":"O16032272659668480" }, "category":"取餐通知", "push_time":"2016-09-29T07:48:00.000Z" }, "where":{ "objectId":"qF4HNdi26hDUBpOm9eBV6SrVFQ4Py1VX" } }
leancloud后台推送结果
{
"updatedAt": "2016-09-29T07:37:22.317Z",
"where": {
"query": {
"_id": "qF4HNdi26hDUBpOm9eBV6SrVFQ4Py1VX"
},
"sort": {
"createdAt": 1
}
},
"push-time": null,
"prod": "prod",
"notificationId": "ziNKpfY7vBmVhNeS",
"createdAt": "2016-09-29T07:37:14.091Z",
"msg": {
"badge": "Increment",
"expiration_interval": "86400",
"alert": "定时测试: Thu Sep 29 15:37:11 CST 2016",
"sound": "default",
"type": "orderDetail",
"params": {
"id": "O16032272659668480"
},
"category": "取餐通知",
"push_time": "2016-09-29T07:48:00.000Z"
},
"successes": 1,
"status": "done",
"devices": 1,
"pushedAt": "2016-09-29T07:37:15.102Z",
"through?": null
}
推荐主题
主题 | 分类 | 回复 | 浏览 | 活动 |
---|---|---|---|---|
Android混合推送桌面角标红点数字 | 推送通知 | 2 | 1.3K | 21-09-9 |
无法创建 APNs 连接,可能您没有上传 Development 推送证书 | 推送通知 | 8 | 2.3K | 16-05-16 |
RESTful API定时推送状态一直都是schedule | 推送通知 | 0 | 893 | 15-10-3 |
聊天消息推送为什么会使用开发环境"prod": “dev"? | 推送通知 | 2 | 1.0K | 20-09-5 |
iOS推送出错, 一直都推送生产证书 | 推送通知 | 9 | 1.6K | 16-04-29 |