From 92da73fc984d0d802a7516a57623777795539bce Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Tue, 16 Jan 2024 23:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=B7=AF=E5=BE=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/api/api.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index f0e9446d..9b83ca59 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -42,6 +42,13 @@ def init(): return ReJson(1002) if not os.path.exists(wx_path): return ReJson(1001) + save_msg_path = read_session(g.sf, "msg_path") + save_micro_path = read_session(g.sf, "micro_path") + save_my_wxid = read_session(g.sf, "my_wxid") + if save_msg_path and save_micro_path and os.path.exists(save_msg_path) and os.path.exists( + save_micro_path) and save_my_wxid == my_wxid: + return ReJson(0, {"msg_path": save_msg_path, "micro_path": save_micro_path, "is_init": True}) + # 解密 WxDbPath = get_wechat_db('all', None, wxid=my_wxid, is_logging=False) # 获取微信数据库路径 if isinstance(WxDbPath, str): # 如果返回的是字符串,则表示出错 @@ -104,7 +111,30 @@ def init(): return ReJson(0, rdata) else: - return ReJson(1002) + if not msg_path or not micro_path or not media_path or not wx_path or not my_wxid: + return ReJson(1002) + if not os.path.exists(msg_path) or not os.path.exists(micro_path) or not os.path.exists( + media_path) or not os.path.exists(wx_path): + return ReJson(1001) + + save_session(g.sf, "msg_path", msg_path) + save_session(g.sf, "micro_path", micro_path) + save_session(g.sf, "media_path", media_path) + save_session(g.sf, "wx_path", wx_path) + save_session(g.sf, "key", "") + save_session(g.sf, "my_wxid", my_wxid) + + rdata = { + "msg_path": msg_path, + "micro_path": micro_path, + "media_path": media_path, + "wx_path": wx_path, + "key": "", + "my_wxid": my_wxid, + "is_init": True, + } + return ReJson(0, rdata) + except Exception as e: return ReJson(9999, msg=str(e))