"push-time": {
"__type": "Date",
"iso": "2016-09-25T01:58:00.000Z"
}
确实是UTC时间

首先是 push_time,不是push-time

其次,确保 URL 是 1.1 协议,1.0 协议的时区是错误的。

最后,push_time 是一个字符串,不是一个 date 对象,并且跟 where ,data 同一层。。

1 人赞了这个帖子.

您看下我后来贴的图。。。确实都是这样做的

你贴图里的字段 push-time(这是转化后的定时推送时间) 都为 null,表示传过来的 push_time 要么格式非法,要么时间是当前时间之前。

暂时无法判断了,你还是附上代码吧。

{
"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和push_time 有什么关系?

记录的 push-time 是转换后的 push_time

"push_time": "2016-09-24T17:52:29.773Z",
请问 这段json 有什么问题,为什么会转后为null?

你用的是不是 1 协议,而不是 1.1,最好附上代码吧,我测试没有问题的,这个功能也很多人在用。

我们用的确实是1.1的接口。。。。

你的 push_time 放到 data 里,贴图里的push_time 出现在 msg 字段,那就是 data。

1 人赞了这个帖子.

我的push_time确实没在msg里,和data是同一层的。。

你自己贴出来的 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"
}
}
}

绝对是层次搞错了,将你发送的请求打印出来,自己检查下吧。

"data": {
"badge": "Increment",
"alert": "2016-09-24T17:58:00.000Z",
"sound": "default",
"type": "orderDetail",
"params": {
"id": "O16032272659668480"
},
"category": "取餐通知",
"push_time": "2016-09-29T07:02:00.000Z"
}

这样也是不可以的

关键你的 data 又嵌套了 data 了。。

你要么贴代码,或者打印请求 body,没有别的办法了。

这是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
}

不是很明显了吗? 你的 push_time 放到 data 里了,我前面说了好几次了。。