From 3d8f121339c6ad97262e4d04a167cf776c6aa392 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Tue, 28 Apr 2026 01:33:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit error returned from database: (code: 1) cannot start a transaction within a transaction --- src/plugins/Sqlite/modules/userGacha.ts | 7 +++---- src/plugins/Sqlite/modules/userGachaB.ts | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/Sqlite/modules/userGacha.ts b/src/plugins/Sqlite/modules/userGacha.ts index d2fba979..f3d0b43c 100644 --- a/src/plugins/Sqlite/modules/userGacha.ts +++ b/src/plugins/Sqlite/modules/userGacha.ts @@ -1,6 +1,6 @@ /** * 用户祈愿模块 - * @since Beta v0.9.8 + * @since Beta v0.10.1 */ import showDialog from "@comp/func/dialog.js"; @@ -14,7 +14,7 @@ import TGSqlite from "../index.js"; /** * 批量插入祈愿数据 - * @since Beta v0.9.8 + * @since Beta v0.10.1 * @param db - 数据库 * @param uid - 用户UID * @param data - 祈愿数据 @@ -83,13 +83,12 @@ async function insertGachaList( await db.execute(batchSql, batchParams); await db.execute("COMMIT;"); } catch (e) { + await db.execute("ROLLBACK;"); const msg = String(e); if (/BUSY|LOCKED|SQLITE_BUSY|SQLITE_LOCKED/i.test(msg)) { await showDialog.check(`数据库锁定`, `请刷新页面(F5)后重试操作`); return; } - // 其他错误直接抛出 - await db.execute("ROLLBACK;"); throw e; } } diff --git a/src/plugins/Sqlite/modules/userGachaB.ts b/src/plugins/Sqlite/modules/userGachaB.ts index f8f79b97..491d46a4 100644 --- a/src/plugins/Sqlite/modules/userGachaB.ts +++ b/src/plugins/Sqlite/modules/userGachaB.ts @@ -1,6 +1,6 @@ /** * 千星奇域祈愿模块 - * @since Beta v0.9.8 + * @since Beta v0.10.1 */ import showDialog from "@comp/func/dialog.js"; @@ -14,7 +14,7 @@ import { AppGachaBData } from "@/data/index.js"; /** * 批量插入颂愿数据 - * @since Beta v0.9.8 + * @since Beta v0.10.1 * @param db - 数据库 * @param uid - 用户UID * @param data - 祈愿数据 @@ -84,13 +84,12 @@ async function insertGachaBList( await db.execute(batchSql, batchParams); await db.execute("COMMIT;"); } catch (e) { + await db.execute("ROLLBACK;"); const msg = String(e); if (/BUSY|LOCKED|SQLITE_BUSY|SQLITE_LOCKED/i.test(msg)) { await showDialog.check(`数据库锁定`, `请刷新页面(F5)后重试操作`); return; } - // 其他错误直接抛出 - await db.execute("ROLLBACK;"); throw e; } }