定时计算任务时间 本地运行没问题 只要走云函数的定时就不行 现在也不知道是哪里出的问题
var date
if (event.dates) {
date = event.dates.replace(/-/g, "/")
} else {
date = new Date().toLocaleDateString()
// date = "2021/4/1"
}
const typeok = await db.collection('record').where({
date: new Date(date)
}).orderBy("_id", "desc").limit(1).get()
if (typeok.affectedDocs > 0) {
const shicha = timeDifference(typeok.data[0].startTime, "12:00")
if (shicha > 0) {
let edit = await db.collection('record').doc(typeok.data[0]._id).update({
endTime: "12:00",
times: timeDifference(typeok.data[0].startTime, "12:00")
});
var startTime = "13:30";
var endTime = "18:30";
var times = timeDifference(startTime, endTime);
let res = await db.collection('record').add({
startTime: startTime,
endTime: endTime,
times: times,
tast: typeok.data[0].tast,
date: new Date(date)
})
return res
}
}
//返回数据给客户端
return {}
0 个回复