Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

34 lines
1.1KB

  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": "操作成功"}