|
@@ -9,7 +9,8 @@ const WXBizDataCrypt = require('./WXBizDataCrypt')
|
|
|
|
|
|
|
|
cloud.init()
|
|
cloud.init()
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+const db = cloud.database()
|
|
|
|
|
+const errorLogs = db.collection("huihenduo_error_log")
|
|
|
|
|
|
|
|
// 云函数入口函数
|
|
// 云函数入口函数
|
|
|
exports.main = async (event, context) => {
|
|
exports.main = async (event, context) => {
|
|
@@ -55,6 +56,18 @@ exports.main = async (event, context) => {
|
|
|
}
|
|
}
|
|
|
await next()
|
|
await next()
|
|
|
})
|
|
})
|
|
|
|
|
+ app.router("sendError", async (ctx, next) => {
|
|
|
|
|
+ delete event.$url
|
|
|
|
|
+ delete event.userInfo
|
|
|
|
|
+ let res = await errorLogs.add({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ createTime: db.serverDate(),
|
|
|
|
|
+ ...event,
|
|
|
|
|
+ _openid,
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ await next()
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
app.router("base", async (ctx, next) => {
|
|
app.router("base", async (ctx, next) => {
|
|
|
|
|
|