实装祈愿记录获取

This commit is contained in:
BTMuli
2023-09-04 16:57:11 +08:00
parent 4fef4d94e1
commit ad11a91f73
5 changed files with 192 additions and 21 deletions

View File

@@ -2,13 +2,12 @@
* @file utils UIGF.ts
* @description UIGF工具类
* @author BTMuli <bt-muli@outlook.com>
* @since Alpha v0.2.3
* @since Beta v0.3.0
*/
// tauri
import { app, fs, path } from "@tauri-apps/api";
// utils
import TGSqlite from "../plugins/Sqlite";
import { timestampToDate } from "./t2D";
/**
@@ -113,19 +112,3 @@ export async function backupUigfData(
const savePath = `${await path.appLocalDataDir()}userData\\UIGF_${uid}.json`;
await exportUigfData(uid, gachaList, savePath);
}
/**
* @description 恢复 UIGF 数据
* @since Alpha v0.2.3
* @param {string} uid - UID
* @returns {Promise<boolean>} UIGF 数据
*/
export async function restoreUigfData(uid: string): Promise<boolean> {
const uigfPath = `${await path.appLocalDataDir()}userData\\UIGF_${uid}.json`;
if (!(await fs.exists(uigfPath))) {
return false;
}
const uigfData = await readUigfData(uigfPath);
await TGSqlite.mergeUIGF(uid, uigfData.list);
return true;
}