this.realHandler is not a function?
{“errorCode”:1,“errorMessage”:“user code exception caught”,“stackTrace”:“TypeError: this.realHandler is not a function\n at EventHandler.handle (/var/runtime/node8/bootstrap.js:405:28)\n at invoke (/var/runtime/node8/bootstrap.js:208:22)\n at Timeout.setTimeout [as _onTimeout] (/var/runtime/node8/bootstrap.js:137:9)\n at ontimeout (timers.js:475:11)\n at tryOnTimeout (timers.js:310:5)\n at Timer.listOnTimeout (timers.js:270:5)”}
麻烦各位大神帮忙看看是什么问题
1 回复
const axios = require'axios')
const baseUrl =
'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=995e97a1xxxxxxxxxxxxxxxxxxx'
async function bookLunch() let result = await axios.post(baseUrl, {
msgtype: 'text',
text: {
content:'大佬,订午餐啦!',
mentioned_list: ['@all'] // 提醒所有人
}
})
return result.data
}
async function bookTaxi() let result = await axios.post(baseUrl, {
msgtype: 'text',
text: {
content:'辛苦了,早点回家休息吧。9点打车可以报销哦。',
mentioned_list: ['@all']
}
})
return result.data
}
async function remindWeeklyReport() let result = await axios.post(baseUrl, {
msgtype: 'text',
text: {
content:'周四了,记得写周报看看你这周有没偷懒!',
mentioned_list: ['@all']
}
})
return result.data
}
async function remindGoHome() {
let result = await axios.post(baseUrl, {
msgtype: 'text',
text: {
content:'11点半了,早点休息吧!'
}
})
return result.data
}
// 是否周五functionisFridayday) {return day ===
}
// 是否周四functionisThursdayday) {return day ===
}
// 是否工作日functionisWeekDayday) {return day > && day <
}
// 是否30分,多预留分钟以防云函数延迟启动或执行functionisHalfHourmin) {returnmin >= 30 && min <= 31
}
// 是否正点,多预留分钟以防云函数延迟启动或执行functionisSharpmin) {returnmin >= && min <=
}
exports.main = async (event, context) => {
let d = newDate() // js 时间对象let day = d.getDay() // 获取今天是星期几, 表示周日let hour = d.getHours() // 获取当前的 时letmin = d.getMinutes() // 获取当前的 分
let hourGap = // 咱们在东区
hour += hourGap // 获取当前准确的时间数
// 打一下 log 看看具体时间console.log(`day: ${day} hour: ${hour} min: ${min} hourGap: ${hourGap})
// 每周四点到点半通知写周报if (isThursday(day) && hour === && isHalfHour(min)) {
returnawait remindWeeklyReport()
}
// 工作日每天11点提醒订餐// if (isWeekDay(day) && hour === 11 && isSharp(min)) {// return await bookLunch()// }
// 工作日每天晚上点提醒打车可以报销if (isWeekDay(day) && hour === 21 && isSharp(min)) {
returnawait bookTaxi()
}
// 工作日每天晚上11点半提醒休息if (isWeekDay(day) && hour === 23 && isHalfHour(min)) {
returnawait remindGoHome()
}
return'hi shopee!'
}