fix export
This commit is contained in:
parent
df409fa39b
commit
56d8f9b4dd
@ -337,13 +337,12 @@ def get_export_endb():
|
||||
"""
|
||||
my_wxid = get_conf(g.caf, g.at, "last")
|
||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||
wx_path = get_conf(g.caf, my_wxid, "wx_path")
|
||||
wx_path = request.json.get("wx_path", wx_path)
|
||||
|
||||
wx_path = request.json.get("wx_path", "")
|
||||
if not wx_path:
|
||||
wx_path = get_conf(g.caf, my_wxid, "wx_path")
|
||||
if not os.path.exists(wx_path if wx_path else ""):
|
||||
return ReJson(1002, body=f"wx_path is required: {wx_path}")
|
||||
if not os.path.exists(wx_path):
|
||||
return ReJson(1001, body=f"wx_path not exists: {wx_path}")
|
||||
|
||||
# 分割wx_path的文件名和父目录
|
||||
code, wxdbpaths = get_core_db(wx_path)
|
||||
@ -357,7 +356,8 @@ def get_export_endb():
|
||||
for wxdb in wxdbpaths:
|
||||
# 复制wxdb->outpath, os.path.basename(wxdb)
|
||||
assert isinstance(outpath, str) # 为了解决pycharm的警告, 无实际意义
|
||||
shutil.copy(wxdb, os.path.join(outpath, os.path.basename(wxdb)))
|
||||
wxdb_path = wxdb.get("db_path")
|
||||
shutil.copy(wxdb_path, os.path.join(outpath, os.path.basename(wxdb_path)))
|
||||
return ReJson(0, body=outpath)
|
||||
|
||||
|
||||
@ -367,11 +367,19 @@ def get_export_dedb():
|
||||
导出解密数据库
|
||||
:return:
|
||||
"""
|
||||
if request.method not in ["GET", "POST"]:
|
||||
return ReJson(1003, msg="Unsupported method")
|
||||
rq_data = request.json if request.method == "POST" else request.args
|
||||
key = rq_data.get("key", "")
|
||||
wx_path = rq_data.get("wx_path", "")
|
||||
|
||||
my_wxid = get_conf(g.caf, g.at, "last")
|
||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||
|
||||
key = request.json.get("key", get_conf(g.caf, my_wxid, "key"))
|
||||
wx_path = request.json.get("wx_path", get_conf(g.caf, my_wxid, "wx_path"))
|
||||
if not key:
|
||||
key = get_conf(g.caf, my_wxid, "key")
|
||||
if not wx_path:
|
||||
wx_path = get_conf(g.caf, my_wxid, "wx_path")
|
||||
|
||||
if not key:
|
||||
return ReJson(1002, body=f"key is required: {key}")
|
||||
@ -383,7 +391,7 @@ def get_export_dedb():
|
||||
outpath = os.path.join(g.work_path, "export", my_wxid, "dedb")
|
||||
if not os.path.exists(outpath):
|
||||
os.makedirs(outpath)
|
||||
|
||||
assert isinstance(outpath, str)
|
||||
code, merge_save_path = decrypt_merge(wx_path=wx_path, key=key, outpath=outpath)
|
||||
time.sleep(1)
|
||||
if code:
|
||||
|
Loading…
Reference in New Issue
Block a user