新增KV数据库存储附件

This commit is contained in:
eoao
2025-10-21 20:45:20 +08:00
parent dad4a22356
commit fdf9e95d67
18 changed files with 213 additions and 73 deletions

View File

@@ -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 })
},