🎨 fix(ck): 删除 rocket,采用手动 cv

This commit is contained in:
BTMuli
2023-05-04 21:05:01 +08:00
parent 50f2305d5e
commit baff5a17c6
5 changed files with 133 additions and 704 deletions

View File

@@ -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