mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🎨 fix(ck): 删除 rocket,采用手动 cv
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @description 数据库操作类
|
||||
* @class TGSqlite
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.4
|
||||
* @since Alpha v0.2.0
|
||||
*/
|
||||
|
||||
// tauri
|
||||
@@ -67,6 +67,37 @@ class TGSqlite {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 输入 cookie
|
||||
* @memberof TGSqlite
|
||||
* @since Alpha v0.2.0
|
||||
* @param {string} cookie
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async inputCookie (cookie: string): Promise<void> {
|
||||
const db = await Database.load(this.dbPath);
|
||||
const sql = `
|
||||
INSERT INTO AppData (key, value, updated)
|
||||
VALUES ('cookie', '${cookie}', datetime('now', 'localtime'))
|
||||
ON CONFLICT(key) DO UPDATE SET value = '${cookie}', updated = datetime('now', 'localtime');`;
|
||||
await db.execute(sql);
|
||||
await db.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取 cookie
|
||||
* @memberof TGSqlite
|
||||
* @since Alpha v0.2.0
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public async getCookie (): Promise<string> {
|
||||
const db = await Database.load(this.dbPath);
|
||||
const sql = "SELECT value FROM AppData WHERE key='cookie';";
|
||||
const res: Array<{ value: string }> = await db.select(sql);
|
||||
await db.close();
|
||||
return res[0].value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 已有数据表跟触发器不变的情况下,更新数据库数据
|
||||
* @memberof TGSqlite
|
||||
|
||||
Reference in New Issue
Block a user