新增KV数据库存储附件
This commit is contained in:
@@ -3,10 +3,11 @@ import { email } from './email/email';
|
||||
import userService from './service/user-service';
|
||||
import verifyRecordService from './service/verify-record-service';
|
||||
import emailService from './service/email-service';
|
||||
import kvObjService from './service/kv-obj-service';
|
||||
export default {
|
||||
async fetch(req, env, ctx) {
|
||||
const url = new URL(req.url)
|
||||
|
||||
const url = new URL(req.url)
|
||||
|
||||
if (url.pathname.startsWith('/api/')) {
|
||||
url.pathname = url.pathname.replace('/api', '')
|
||||
@@ -14,12 +15,15 @@ export default {
|
||||
return app.fetch(req, env, ctx);
|
||||
}
|
||||
|
||||
if (['/static/','/attachments/'].some(p => url.pathname.startsWith(p))) {
|
||||
return await kvObjService.toObjResp( { env }, url.pathname.substring(1));
|
||||
}
|
||||
|
||||
return env.assets.fetch(req);
|
||||
},
|
||||
email: email,
|
||||
async scheduled(c, env, ctx) {
|
||||
await verifyRecordService.clearRecord({env})
|
||||
await verifyRecordService.clearRecord({ env })
|
||||
await userService.resetDaySendCount({ env })
|
||||
await emailService.completeReceiveAll({ env })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user