fix
This commit is contained in:
parent
a4fb7508b3
commit
e771ec1c32
@ -11,7 +11,7 @@ import shutil
|
|||||||
import pythoncom
|
import pythoncom
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter, Body
|
||||||
|
|
||||||
from pywxdump import all_merge_real_time_db, get_wx_db
|
from pywxdump import all_merge_real_time_db, get_wx_db
|
||||||
from pywxdump import get_wx_info, batch_decrypt, BiasAddr, merge_db, decrypt_merge
|
from pywxdump import get_wx_info, batch_decrypt, BiasAddr, merge_db, decrypt_merge
|
||||||
@ -38,9 +38,9 @@ def init_last_local_wxid():
|
|||||||
return ReJson(0, {"local_wxids": []})
|
return ReJson(0, {"local_wxids": []})
|
||||||
|
|
||||||
|
|
||||||
@ls_api.api_route('/init_last', methods=["GET", 'POST'])
|
@ls_api.post('/init_last')
|
||||||
@error9999
|
@error9999
|
||||||
def init_last(my_wxid: str):
|
def init_last(my_wxid: str = Body(..., embed=True)):
|
||||||
"""
|
"""
|
||||||
是否初始化
|
是否初始化
|
||||||
:return:
|
:return:
|
||||||
|
@ -13,7 +13,7 @@ from urllib.parse import quote
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from fastapi import APIRouter,Response
|
from fastapi import APIRouter, Response, Body
|
||||||
from starlette.responses import StreamingResponse, FileResponse
|
from starlette.responses import StreamingResponse, FileResponse
|
||||||
|
|
||||||
import pywxdump
|
import pywxdump
|
||||||
@ -110,18 +110,13 @@ def user_list(word: str = "", wxids: List[str] = None, labels: List[str] = None)
|
|||||||
|
|
||||||
# start 以下为聊天记录相关api *********************************************************************************************
|
# start 以下为聊天记录相关api *********************************************************************************************
|
||||||
|
|
||||||
class MsgCountRequest(BaseModel):
|
|
||||||
wxids: Optional[List[str]]
|
|
||||||
|
|
||||||
|
|
||||||
@rs_api.post('/msg_count')
|
@rs_api.post('/msg_count')
|
||||||
@error9999
|
@error9999
|
||||||
def msg_count(request: MsgCountRequest):
|
def msg_count(wxids: Optional[List[str]] = Body(..., embed=True)):
|
||||||
"""
|
"""
|
||||||
获取联系人的聊天记录数量
|
获取联系人的聊天记录数量
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
wxids = request.wxids
|
|
||||||
my_wxid = gc.get_conf(gc.at, "last")
|
my_wxid = gc.get_conf(gc.at, "last")
|
||||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||||
db_config = gc.get_db_config()
|
db_config = gc.get_db_config()
|
||||||
@ -130,22 +125,13 @@ def msg_count(request: MsgCountRequest):
|
|||||||
return ReJson(0, count)
|
return ReJson(0, count)
|
||||||
|
|
||||||
|
|
||||||
class MsgListRequest(BaseModel):
|
|
||||||
wxid: str
|
|
||||||
start: int
|
|
||||||
limit: int
|
|
||||||
|
|
||||||
|
|
||||||
@rs_api.api_route('/msg_list', methods=["GET", 'POST'])
|
@rs_api.api_route('/msg_list', methods=["GET", 'POST'])
|
||||||
@error9999
|
@error9999
|
||||||
def get_msgs(request: MsgListRequest):
|
def get_msgs(wxid: str = Body(...), start: int = Body(...), limit: int = Body(...)):
|
||||||
"""
|
"""
|
||||||
获取联系人的聊天记录
|
获取联系人的聊天记录
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
wxid = request.wxid
|
|
||||||
start = request.start
|
|
||||||
limit = request.limit
|
|
||||||
|
|
||||||
my_wxid = gc.get_conf(gc.at, "last")
|
my_wxid = gc.get_conf(gc.at, "last")
|
||||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||||
@ -292,13 +278,8 @@ def get_audio(src: str):
|
|||||||
return ReJson(4004, body=savePath)
|
return ReJson(4004, body=savePath)
|
||||||
|
|
||||||
|
|
||||||
class FileInfoRequest(BaseModel):
|
|
||||||
file_path: str
|
|
||||||
|
|
||||||
|
|
||||||
@rs_api.api_route('/file_info', methods=["GET", 'POST'])
|
@rs_api.api_route('/file_info', methods=["GET", 'POST'])
|
||||||
def get_file_info(request: FileInfoRequest):
|
def get_file_info(file_path: str = Body(..., embed=True)):
|
||||||
file_path = request.file_path
|
|
||||||
if not file_path:
|
if not file_path:
|
||||||
return ReJson(1002)
|
return ReJson(1002)
|
||||||
|
|
||||||
@ -429,22 +410,16 @@ def get_export_dedb(request: ExportDedbRequest):
|
|||||||
return ReJson(2001, body=merge_save_path)
|
return ReJson(2001, body=merge_save_path)
|
||||||
|
|
||||||
|
|
||||||
class ExportCsvRequest(BaseModel):
|
|
||||||
wxid: str
|
|
||||||
|
|
||||||
|
|
||||||
@rs_api.api_route('/export_csv', methods=["GET", 'POST'])
|
@rs_api.api_route('/export_csv', methods=["GET", 'POST'])
|
||||||
def get_export_csv(request: ExportCsvRequest):
|
def get_export_csv(wxid: str = Body(..., embed=True)):
|
||||||
"""
|
"""
|
||||||
导出csv
|
导出csv
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
my_wxid = gc.get_conf(gc.at, "last")
|
my_wxid = gc.get_conf(gc.at, "last")
|
||||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||||
db_config = gc.get_conf(my_wxid, "db_config")
|
db_config = gc.get_conf(my_wxid, "db_config")
|
||||||
|
|
||||||
wxid = request.wxid
|
|
||||||
# st_ed_time = request.json.get("datetime", [0, 0])
|
# st_ed_time = request.json.get("datetime", [0, 0])
|
||||||
if not wxid:
|
if not wxid:
|
||||||
return ReJson(1002, body=f"username is required: {wxid}")
|
return ReJson(1002, body=f"username is required: {wxid}")
|
||||||
@ -465,22 +440,16 @@ def get_export_csv(request: ExportCsvRequest):
|
|||||||
return ReJson(2001, body=ret)
|
return ReJson(2001, body=ret)
|
||||||
|
|
||||||
|
|
||||||
class ExportJsonRequest(BaseModel):
|
|
||||||
wxid: str
|
|
||||||
|
|
||||||
|
|
||||||
@rs_api.api_route('/export_json', methods=["GET", 'POST'])
|
@rs_api.api_route('/export_json', methods=["GET", 'POST'])
|
||||||
def get_export_json(request: ExportJsonRequest):
|
def get_export_json(wxid: str = Body(..., embed=True)):
|
||||||
"""
|
"""
|
||||||
导出json
|
导出json
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
my_wxid = gc.get_conf(gc.at, "last")
|
my_wxid = gc.get_conf(gc.at, "last")
|
||||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||||
db_config = gc.get_conf(my_wxid, "db_config")
|
db_config = gc.get_conf(my_wxid, "db_config")
|
||||||
|
|
||||||
wxid = request.wxid
|
|
||||||
if not wxid:
|
if not wxid:
|
||||||
return ReJson(1002, body=f"username is required: {wxid}")
|
return ReJson(1002, body=f"username is required: {wxid}")
|
||||||
|
|
||||||
@ -500,17 +469,15 @@ class ExportHtmlRequest(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
@rs_api.api_route('/export_html', methods=["GET", 'POST'])
|
@rs_api.api_route('/export_html', methods=["GET", 'POST'])
|
||||||
def get_export_html(request: ExportHtmlRequest):
|
def get_export_html(wxid: str = Body(..., embed=True)):
|
||||||
"""
|
"""
|
||||||
导出json
|
导出json
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
my_wxid = gc.get_conf(gc.at, "last")
|
my_wxid = gc.get_conf(gc.at, "last")
|
||||||
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
if not my_wxid: return ReJson(1001, body="my_wxid is required")
|
||||||
db_config = gc.get_conf(my_wxid, "db_config")
|
db_config = gc.get_conf(my_wxid, "db_config")
|
||||||
|
|
||||||
wxid = request.wxid
|
|
||||||
if not wxid:
|
if not wxid:
|
||||||
return ReJson(1002, body=f"username is required: {wxid}")
|
return ReJson(1002, body=f"username is required: {wxid}")
|
||||||
|
|
||||||
@ -692,5 +659,4 @@ def get_readme():
|
|||||||
else:
|
else:
|
||||||
return ReJson(2001, body="status_code is not 200")
|
return ReJson(2001, body="status_code is not 200")
|
||||||
|
|
||||||
|
|
||||||
# END 关于、帮助、设置 ***************************************************************************************************
|
# END 关于、帮助、设置 ***************************************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user