Commit 7ede10fd by Sixong.Zhu

update cache

parent 0deb5a58
Showing with 15 additions and 0 deletions
......@@ -313,6 +313,21 @@ class ChatCacheDatabaseController {
});
}
public getChatByCode(code: string) {
return new Promise<Chat | null>((resolve) => {
if (!this.db) {
return resolve(null);
}
const store = this.buildStore(this.chatListKey);
const r = store.getAll();
r.onsuccess = (o) => {
const items = (o.target as any).result as Chat[];
resolve(items.find(i => i.biz_type_code === code) as Chat);
};
r.onerror = () => resolve(null);
});
}
private buildChatMessageStore(chat: number) {
const k = this.buildChatMessageKey(chat);
const db = this.messageDatabases.get(k) as IDBDatabase;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment