Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

add_contacts_endpoint.py 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. from fastapi import APIRouter,Request,FastAPI
  2. from pydantic import BaseModel
  3. from fastapi import APIRouter, Depends
  4. from pydantic import BaseModel, ValidationError
  5. from common.log import logger
  6. add_contacts_group_history_router = APIRouter(prefix="/api/addcontactsfromchatroomhistory")
  7. class ClearAddContactsGroupHistoryRequest(BaseModel):
  8. wxid: str
  9. chatroomId:str
  10. @add_contacts_group_history_router.post("/clear",response_model=None)
  11. async def add_contacts_group_history_clear(request: Request, body: ClearAddContactsGroupHistoryRequest, ):
  12. wxid = body.wxid
  13. chatroom_id=body.chatroomId
  14. if not wxid:
  15. return {"code": 400, "message": "wxid 不能为空"}
  16. k,loginfo=await request.app.state.gewe_service.get_login_info_by_wxid_async(wxid)
  17. if not k:
  18. return {"code":404,"message":f"{wxid} 没有对应的登录信息"}
  19. await request.app.state.gewe_service.delete_group_add_contacts_history_async(wxid,chatroom_id)
  20. logger.info(f"删除群聊添加好友历史 wxid:{wxid} chatroomId:{chatroom_id}")
  21. return {"message": "操作成功"}