利用leancloud做小程序的后台,但是在前台拿不到数据,
下面是前台的代码
AV.Cloud.run('mark',params).then(function (data) {
//data = JSON.parse(data);
console.log("get data from cloud "+JSON.stringify(data));
})
后台的代码
var query = new AV.Query('controlMark');
var showTime = request.params.showTime;
var rowTime = request.params.rowTime;
var id = request.params.ID;
query.equalTo('ID', id);
query.descending('createdAt');
query.limit(1);
query.find().then(function (cmark) {
var controlMark = AV.Object.extend('controlMark');
var mark = new controlMark();
mark.set('markTime', showTime);
mark.set('day', 0);
mark.set('rowTime', rowTime);
mark.set('ID', id);
mark.save().then(function(controlM){
var yesterday = self.getYesterday();
var queryPay = new AV.Query('controlPay');
queryPay.equalTo('ID', id);
queryPay.equalTo('payDay',yesterday);
return queryPay.find().then(function(yesterdayPay){
if(yesterdayPay.length != '0'){
var controlPayback = AV.Object.extend('controlPayback');
var cpayback = new controlPayback();
cpayback.set('markDay', rowTime);
cpayback.set('ID', id);
return cpayback.save().then(function(){
var loadingHidden = true;
var conut = 2000;
var toastText = 'Success';
var result = {
'loadingHidden':loadingHidden,
'conut':conut,
'toastText':toastText
};
return result;
});
}
});
})
})
前台拿到的data结果是undefined,这是为什么呢?