我写了这段代码:
const reports = this.app.service('generate-reports');
var job = new CronJob({
cronTime: '* * * * * *',
onTick: await reports => {
var current_date = moment().hours(0).minutes(0).seconds(0).milliseconds(0).toISOString();
var data = {
date: current_date,
};
await reports.patch(null, data);
},
start: false,
timeZone: 'Europe/Warsaw'
});
job.start();
但是当我尝试运行它时,我收到了这个错误:
info: Feathers application started on http://localhost:3030
error: Unhandled Rejection at: Promise Promise {
<rejected> TypeError: Cannot read property 'patch' of undefined
问题是什么?在此先感谢您的任何帮助;)