mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-23 05:09:45 +08:00
🌱 修复数据库读取异常,页面草创
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Sqlite 数据库操作类
|
||||
* @since Beta v0.8.4
|
||||
* @since Beta v0.9.0
|
||||
*/
|
||||
|
||||
import { app } from "@tauri-apps/api";
|
||||
@@ -27,6 +27,8 @@ class Sqlite {
|
||||
"UserAccount",
|
||||
"UserCharacters",
|
||||
"UserRecord",
|
||||
// TODO: v0.9.0 进行注释移除
|
||||
// "UserBagMaterial"
|
||||
];
|
||||
private db: Database | null = null;
|
||||
private static instance: Sqlite | null = null;
|
||||
|
||||
@@ -95,14 +95,15 @@ async function getMaterial(
|
||||
): Promise<Array<TGApp.Sqlite.UserBag.TableMaterial>> {
|
||||
const db = await TGSqlite.getDB();
|
||||
let res: Array<TGApp.Sqlite.UserBag.TableMaterialRaw>;
|
||||
if (id) {
|
||||
// TODO: 排序
|
||||
if (id !== undefined) {
|
||||
res = await db.select<Array<TGApp.Sqlite.UserBag.TableMaterialRaw>>(
|
||||
"SELECT * FROM UserBagMaterial WHERE uid = ? AND id = ?",
|
||||
"SELECT * FROM UserBagMaterial WHERE uid = ? AND id = ?;",
|
||||
[uid, id],
|
||||
);
|
||||
} else {
|
||||
res = await db.select<Array<TGApp.Sqlite.UserBag.TableMaterialRaw>>(
|
||||
"SELECT * FROM UserBagMaterial WHERE uid =",
|
||||
"SELECT * FROM UserBagMaterial WHERE uid =?;",
|
||||
[uid],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user