From 6b05aa49faafce6310b89c7702614f746a944b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=97=E8=BE=9E?= Date: Thu, 11 Sep 2025 13:40:05 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/CallServerAPIs.py | 11 +++++++++++ core/DBServices.py | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 core/DBServices.py diff --git a/core/CallServerAPIs.py b/core/CallServerAPIs.py index f48bd07..cd7a027 100644 --- a/core/CallServerAPIs.py +++ b/core/CallServerAPIs.py @@ -90,3 +90,14 @@ def DeleteChatRoom(Authorization: str, id: str) -> dict: headers = {'accept': 'application/json', 'Authorization': Authorization} return _make_request('DELETE', url, headers) +def CreateChatWithRealm(Authorization: str) -> dict: + """创建聊天房间""" + url = f"{DOMAIN}/chat" + headers = {'accept': 'application/json', 'Authorization': Authorization} + return _make_request('POST', url, headers) + +def GetChatToAccount(Authorization: str,accountid: str) -> dict: + """获取聊天对象用户信息""" + url = f"{DOMAIN}/chat/direct/{accountid}" + headers = {'accept': 'application/json', 'Authorization': Authorization} + return _make_request('GET', url, headers) diff --git a/core/DBServices.py b/core/DBServices.py new file mode 100644 index 0000000..8dad4eb --- /dev/null +++ b/core/DBServices.py @@ -0,0 +1,9 @@ +import sqlite3 + +def DBStart(): + conn = sqlite3.connect('./dbfile/App.db') + c = conn.cursor() + c.execute('''CREATE TABLE IF NOT EXISTS chat + (id TEXT PRIMARY KEY, accountid TEXT, name TEXT, avatar TEXT, lastmessage TEXT, lastmessagetime TEXT)''') + conn.commit() + conn.close() \ No newline at end of file