mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
⏪️ func revert
This commit is contained in:
@@ -435,20 +435,13 @@ class Sqlite {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取用户角色数据
|
* @description 获取用户角色数据
|
||||||
* @since Alpha v0.2.1
|
* @since Alpha v0.2.0
|
||||||
* @param {string} uid 用户 uid
|
* @param {string} uid 用户 uid
|
||||||
* @param {number} id 角色 ID
|
|
||||||
* @returns {Promise<TGApp.Sqlite.Character.UserRole[]|false>}
|
* @returns {Promise<TGApp.Sqlite.Character.UserRole[]|false>}
|
||||||
*/
|
*/
|
||||||
public async getUserCharacter(
|
public async getUserCharacter(uid: string): Promise<TGApp.Sqlite.Character.UserRole[] | false> {
|
||||||
uid: string,
|
|
||||||
id?: number,
|
|
||||||
): Promise<TGApp.Sqlite.Character.UserRole[] | false> {
|
|
||||||
const db = await Database.load(this.dbPath);
|
const db = await Database.load(this.dbPath);
|
||||||
let sql = `SELECT * FROM UserCharacters WHERE uid = '${uid}'`;
|
const sql = `SELECT * FROM UserCharacters WHERE uid = '${uid}'`;
|
||||||
if (id) {
|
|
||||||
sql = `SELECT * FROM UserCharacters WHERE uid = '${uid}' AND cid = ${id}`;
|
|
||||||
}
|
|
||||||
const res: TGApp.Sqlite.Character.UserRole[] = await db.select(sql);
|
const res: TGApp.Sqlite.Character.UserRole[] = await db.select(sql);
|
||||||
await db.close();
|
await db.close();
|
||||||
if (res.length === 0) return false;
|
if (res.length === 0) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user