fix: Chat 創建失敗, 並修正了 ChatPrivate 獲取對方的邏輯

This commit is contained in:
CrescentLeaf
2025-09-21 02:17:44 +08:00
parent 71e6d24d6e
commit 6a1084eeca
2 changed files with 10 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ export default class Chat {
/* Chat ID */ id TEXT NOT NULL,
/* 標題 (群組) */ title TEXT,
/* 頭像 (群組) */ avatar BLOB,
/* UserIdA (私信) */ user_a_id TEXT
/* UserIdA (私信) */ user_a_id TEXT,
/* UserIdB (私信) */ user_b_id TEXT,
/* 设置 */ settings TEXT NOT NULL
);
@@ -57,8 +57,8 @@ export default class Chat {
avatar,
user_a_id,
user_b_id,
settings,
) VALUES (?, ?);`).run(
settings
) VALUES (?, ?, ?, ?, ?, ?, ?);`).run(
type,
chatId,
null,
@@ -76,7 +76,7 @@ export default class Chat {
constructor(bean: ChatBean) {
this.bean = bean
}
private setAttr(key: string, value: SQLInputValue): void {
setAttr(key: string, value: SQLInputValue): void {
Chat.database.prepare(`UPDATE ${Chat.table_name} SET ${key} = ? WHERE id = ?`).run(value, this.bean.id)
this.bean[key] = value
}