mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 数据库更新后成就版本自动更新
This commit is contained in:
@@ -177,7 +177,7 @@ import { computed, onMounted, ref } from "vue";
|
|||||||
import TLoading from "../components/overlay/t-loading.vue";
|
import TLoading from "../components/overlay/t-loading.vue";
|
||||||
import TConfirm from "../components/overlay/t-confirm.vue";
|
import TConfirm from "../components/overlay/t-confirm.vue";
|
||||||
// tauri
|
// tauri
|
||||||
import { fs, app, os } from "@tauri-apps/api";
|
import { app, fs, os } from "@tauri-apps/api";
|
||||||
// store
|
// store
|
||||||
import { useAppStore } from "../store/modules/app";
|
import { useAppStore } from "../store/modules/app";
|
||||||
import { useHomeStore } from "../store/modules/home";
|
import { useHomeStore } from "../store/modules/home";
|
||||||
@@ -606,6 +606,7 @@ async function updateDB () {
|
|||||||
loadingTitle.value = "正在更新数据库...";
|
loadingTitle.value = "正在更新数据库...";
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await TGSqlite.update();
|
await TGSqlite.update();
|
||||||
|
achievementsStore.lastVersion = await TGSqlite.getLatestAchievementVersion();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
snackbarText.value = "数据库已是最新!";
|
snackbarText.value = "数据库已是最新!";
|
||||||
snackbarColor.value = "success";
|
snackbarColor.value = "success";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @file utils TGSqlite.ts
|
* @file utils TGSqlite.ts
|
||||||
* @description 数据库操作类
|
* @description 数据库操作类
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
* @since Alpha v0.1.5
|
* @since Alpha v0.1.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tauri
|
// tauri
|
||||||
@@ -263,6 +263,20 @@ class TGSqlite {
|
|||||||
return res[0];
|
return res[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取最新成就版本
|
||||||
|
* @since Alpha v0.1.6
|
||||||
|
* @memberOf TGSqlite
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
public async getLatestAchievementVersion (): Promise<string> {
|
||||||
|
const db = await Database.load(this.dbPath);
|
||||||
|
const sql = "SELECT version FROM AchievementSeries ORDER BY version DESC LIMIT 1;";
|
||||||
|
const res: Array<{ version: string }> = await db.select(sql);
|
||||||
|
await db.close();
|
||||||
|
return res[0].version;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 查询成就
|
* @description 查询成就
|
||||||
* @memberOf TGSqlite
|
* @memberOf TGSqlite
|
||||||
|
|||||||
Reference in New Issue
Block a user