首先是 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
}
推荐主题
主题 | 分类 | 回复 | 浏览 | 活动 |
---|---|---|---|---|
使用云引擎推送消息:AV.Push | 推送通知 | 0 | 869 | 16-03-31 |
ionic3项目开发下载cordova-plugin-leanpush显示报错 | 推送通知 | 16 | 6.0K | 18-02-28 |
创建新短信签名提示审核未通过 | 推送通知 | 7 | 2.7K | 20-05-12 |
以installationId推送怎么自定义receive | 推送通知 | 1 | 778 | 15-12-17 |
美国节点IOS推送无法成功(invalid token) | 推送通知 | 0 | 1.0K | 16-07-7 |