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; } }