0
当我尝试运行以下后台作业时,出现一个错误,指出Result: TypeError: Object [object Object] has no method 'set'
,指向我尝试设置的行该对象的'Number'属性返回值为2
。我以前使用过相同的格式来编辑Parse对象,并且它工作正常,我在这里做错了什么?结果:TypeError:当试图编辑Parse对象时,Object [object Object]没有方法'set'
Parse.Cloud.job("sendLowPush", function(request, status) {
Parse.Cloud.useMasterKey();
/////////////
//send push notification to all users in the "lowPush" channel
//{Query the # value of pushIncrement with object id hKj2Eazz6h}
var pushIncrement = Parse.Object.extend("pushIncrement");
var pushIncrementQuery = new Parse.Query(pushIncrement);
pushIncrementQuery.equalTo('objectId', 'hKj2Eazz6h');
pushIncrementQuery.find({
success: function(results) {
for (var i = 0; i < results.length; ++i) {
var dayNumber = results[i].get("Number");
}
console.log('dem results be:' + dayNumber);
//Figure out whether its day 1, 2, or 3, and increment. Send lowPush if day 3.
if (dayNumber = 1){
//change it to 2
console.log('dayNumber is 1');
results.set('Number', '2');
results.save();
}
else if (dayNumber = 2){
//change it to 3
console.log('dayNumber is 2');
}
status.success("Push Notifications completed successfully.");
},
error: function(error) {
console.log('shit');
status.error('shitty shit');
}
});
});