This commit is contained in:
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user