from fastapi import APIRouter,Request,FastAPI from pydantic import BaseModel from fastapi import APIRouter, Depends from pydantic import BaseModel, ValidationError from common.log import logger add_contacts_group_history_router = APIRouter(prefix="/api/addcontactsfromchatroomhistory") class ClearAddContactsGroupHistoryRequest(BaseModel): wxid: str chatroomId:str @add_contacts_group_history_router.post("/clear",response_model=None) async def add_contacts_group_history_clear(request: Request, body: ClearAddContactsGroupHistoryRequest, ): wxid = body.wxid chatroom_id=body.chatroomId if not wxid: return {"code": 400, "message": "wxid 不能为空"} k,loginfo=await request.app.state.gewe_service.get_login_info_by_wxid_async(wxid) if not k: return {"code":404,"message":f"{wxid} 没有对应的登录信息"} await request.app.state.gewe_service.delete_group_add_contacts_history_async(wxid,chatroom_id) logger.info(f"删除群聊添加好友历史 wxid:{wxid} chatroomId:{chatroom_id}") return {"message": "操作成功"}