Push notification Parse.com通过REST API在安装字段上发送带有查询限制的推送通知
我正在尝试向“updatedAt”字段不超过两天的安装发送推送通知(第二天下午12点)。代码如下:Push notification Parse.com通过REST API在安装字段上发送带有查询限制的推送通知,push-notification,parse-platform,Push Notification,Parse Platform,我正在尝试向“updatedAt”字段不超过两天的安装发送推送通知(第二天下午12点)。代码如下: var two_days_ago_date = new Date() two_days_ago_date.setDate(two_days_ago_date.getDate() - 2) var push_time = new Date() push_time.setDate(push_time.getDate() + 1) push_time.setHours(12) push_time.se
var two_days_ago_date = new Date()
two_days_ago_date.setDate(two_days_ago_date.getDate() - 2)
var push_time = new Date()
push_time.setDate(push_time.getDate() + 1)
push_time.setHours(12)
push_time.setMinutes(00)
push_time = push_time.toISOString()
push_time = push_time.substring(0, push_time.length - 1)
Parse.Cloud.httpRequest({
method: "POST",
headers: {
"X-Parse-Application-Id": "XXX",
"X-Parse-REST-API-Key": "XXX",
"Content-Type": "application/json"
},
body: {
"where":{
"appVersion":"1.4",
"updatedAt" : {"$gte" : two_days_ago_date}
},
"push_time": push_time,
"data": {
"alert":"",
"sound": ""
}
},
url: "https://api.parse.com/1/push"
}).then(function() {
console.log("Successful push");
}, function(error) {
console.log(error);
})
如果我取消了限制,代码可以正常工作,否则就不行。什么不起作用?推送根本就没有发送吗?您看到错误消息了吗?请更具体一点:-)没有错误。推送已计划,但未交付。这是一个好主意。基本上,如果我删除这一行,它就会起作用:
“updatedAt”:{“$gte”:两天前的日期}