我正在尝试将推送通知(第二天中午12点)发送到“updatedAt”字段不超过两天的安装。这是代码:
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);
})
如果我删除了限制,则代码可以正常工作,否则不会。