mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-22 21:59:49 +08:00
🐛 修复数据库buildTime更新异常
This commit is contained in:
10
src/App.vue
10
src/App.vue
@@ -320,8 +320,12 @@ async function checkAppLoad(): Promise<void> {
|
||||
await TGLogger.Error(`[App][checkAppLoad] ${error.name}: ${error.message}`);
|
||||
} else console.error(error);
|
||||
}
|
||||
if (!checkDB) await TGSqlite.update();
|
||||
else await TGLogger.Info("[App][checkAppLoad] 数据库已成功加载!");
|
||||
if (!checkDB) {
|
||||
// @ts-expect-error import.meta
|
||||
buildTime.value = import.meta.env.VITE_BUILD_TIME;
|
||||
// @ts-expect-error import.meta
|
||||
await TGSqlite.update(import.meta.env.VITE_BUILD_TIME);
|
||||
} else await TGLogger.Info("[App][checkAppLoad] 数据库已成功加载!");
|
||||
}
|
||||
|
||||
// 检测 deviceFp
|
||||
@@ -437,7 +441,7 @@ async function checkUpdate(): Promise<void> {
|
||||
}
|
||||
// @ts-expect-error import.meta
|
||||
buildTime.value = import.meta.env.VITE_BUILD_TIME;
|
||||
await TGSqlite.update();
|
||||
await TGSqlite.update(buildTime.value);
|
||||
showFeedback.value = true;
|
||||
showSnackbar.success("数据库已更新!", 3000);
|
||||
await openUrl("https://app.btmuli.ink/docs/TeyvatGuide/changelogs.html");
|
||||
|
||||
@@ -342,7 +342,8 @@ async function confirmUpdate(title?: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
await showLoading.start("正在更新数据库", "");
|
||||
await TGSqlite.update();
|
||||
// @ts-expect-error import.meta
|
||||
await TGSqlite.update(import.meta.env.VITE_BUILD_TIME);
|
||||
// @ts-expect-error import.meta
|
||||
buildTime.value = import.meta.env.VITE_BUILD_TIME;
|
||||
await showLoading.end();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Sqlite 数据库操作类
|
||||
* @since Beta v0.9.9
|
||||
* @since Beta v0.10.0
|
||||
*/
|
||||
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
@@ -127,15 +127,19 @@ class Sqlite {
|
||||
|
||||
/**
|
||||
* 已有数据表跟触发器不变的情况下,更新数据库数据
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.10.0
|
||||
* @param upt - updateTime 更新时间
|
||||
* @returns 无返回值
|
||||
*/
|
||||
public async update(): Promise<void> {
|
||||
public async update(upt?: string): Promise<void> {
|
||||
const db = await this.getDB();
|
||||
const sqlD = await initDataSql();
|
||||
for (const item of sqlD) await db.execute(item);
|
||||
// 检测是否存在字段
|
||||
await this.updateAbyss();
|
||||
if (upt !== undefined) {
|
||||
await this.saveAppData("dataUpdated", upt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user