刚刚
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
var delete_list=''
ordersColle.field({ time: true }).get().then(res => {
this.setData({
delete_list:res.data
})
this.data.delete_list.forEach(function (item, index) {
var nowTime = new Date();
var time=new Date(item.time)
var cha = nowTime.getTime() - time;
var hours = cha/(1000*60*60)
if (hours > 24) {
await db.collection('orders').where({ time: event.time }).remove();
}
})
})
return
}
请看一下这样写有错没有 有错的话正确的应该怎么写