fix 数据库合并的问题

This commit is contained in:
xaoyaoo 2024-04-19 17:33:37 +08:00
parent c504f9e0d7
commit a7571f614e
2 changed files with 27 additions and 20 deletions

View File

@ -636,6 +636,25 @@ def get_wxinfo():
return ReJson(0, wxinfos)
@api.route('/api/biasaddr', methods=["GET", 'POST'])
@error9999
def biasaddr():
"""
BiasAddr
:return:
"""
mobile = request.json.get("mobile")
name = request.json.get("name")
account = request.json.get("account")
key = request.json.get("key", "")
wxdbPath = request.json.get("wxdbPath", "")
if not mobile or not name or not account:
return ReJson(1002)
pythoncom.CoInitialize()
rdata = BiasAddr(account, mobile, name, key, wxdbPath).run()
return ReJson(0, str(rdata))
@api.route('/api/decrypt', methods=["GET", 'POST'])
@error9999
def decrypt():
@ -656,25 +675,6 @@ def decrypt():
return ReJson(0, str(wxinfos))
@api.route('/api/biasaddr', methods=["GET", 'POST'])
@error9999
def biasaddr():
"""
BiasAddr
:return:
"""
mobile = request.json.get("mobile")
name = request.json.get("name")
account = request.json.get("account")
key = request.json.get("key", "")
wxdbPath = request.json.get("wxdbPath", "")
if not mobile or not name or not account:
return ReJson(1002)
pythoncom.CoInitialize()
rdata = BiasAddr(account, mobile, name, key, wxdbPath).run()
return ReJson(0, str(rdata))
@api.route('/api/merge', methods=["GET", 'POST'])
@error9999
def merge():

View File

@ -216,7 +216,14 @@ def merge_db(db_paths, save_path="merge.db", CreateTime: int = 0, endCreateTime:
# alias, file_path
databases = {f"MSG{i}": db_path for i, db_path in enumerate(db_paths)}
elif isinstance(db_paths, str):
databases = {"MSG": db_paths}
# 判断是否是文件or文件夹
if os.path.isdir(db_paths):
db_paths = [os.path.join(db_paths, i) for i in os.listdir(db_paths) if i.endswith(".db")]
databases = {f"MSG{i}": db_path for i, db_path in enumerate(db_paths)}
elif os.path.isfile(db_paths):
databases = {"MSG": db_paths}
else:
raise FileNotFoundError("db_paths 不存在")
else:
raise TypeError("db_paths 类型错误")