fix(四小时导出): 修复无活动事务错误; Excel仅导出活动矩阵总表单Sheet
Deploy to Server / deploy (push) Successful in 1m54s

This commit is contained in:
Trae Assistant
2026-10-07 09:33:38 +08:00
parent b99cfa4d9f
commit 6b4bce4dcf
2 changed files with 42 additions and 61 deletions
+6 -2
View File
@@ -408,8 +408,10 @@ router.post('/four-hour/confirm', authMiddleware, (req: AuthRequest, res) => {
insItem.run(exportId, it.hour_id, it.delta);
}
}
try { db.execCompat('COMMIT'); } catch (err: any) {
if (!/no transaction is active/i.test(String(err?.message || ''))) throw err;
}
db.save();
db.execCompat('COMMIT');
res.json({ ok: true, updated, skipped, total_processed: plan.length, export_id: exportId, total_applied: Number(totalApplied.toFixed(1)) });
} catch (e: any) {
try { db.execCompat('ROLLBACK'); } catch {}
@@ -487,8 +489,10 @@ router.post('/four-hour/void', authMiddleware, (req: AuthRequest, res) => {
`\n[已撤回 ${new Date().toISOString().slice(0,19).replace('T',' ')}${adminUsername ? ' by '+adminUsername : ''}]`,
exportId
);
try { db.execCompat('COMMIT'); } catch (err: any) {
if (!/no transaction is active/i.test(String(err?.message || ''))) throw err;
}
db.save();
db.execCompat('COMMIT');
res.json({ ok: true, export_id: exportId, rolled, skipped, rolled_hours: Number(rolledHours.toFixed(1)) });
} catch (e: any) {
try { db.execCompat('ROLLBACK'); } catch {}