from utils.haikang_util import HaikangUtil import asyncio import base64 # 查询门禁点列表 async def get_door_list_service(pageNo: int = 1, pageSize: int = 10): result = await HaikangUtil.get_door_list_v2(pageNo, pageSize) print(result) # 查询门禁状态 async def get_door_status_service(door_index_codes): result = await HaikangUtil.get_door_status(door_index_codes) print(result) # 门禁控制 async def door_do_control_service(door_index_codes, control_type): result = await HaikangUtil.door_do_control(door_index_codes, control_type) print(result) # 查询门禁点事件 async def query_door_events_service(door_index_code,pageNo, pageSize, startTime, endTime): result = await HaikangUtil.query_door_events_v2(door_index_code, pageNo=pageNo, pageSize=pageSize ,startTime=startTime, endTime=endTime) print(result) # 查看门禁点在线状态 async def door_online_status_service(door_index_codes): result = await HaikangUtil.door_online_status(door_index_codes) print(result) # 按条件查询人脸分组, 很重要 async def get_face_group_service(): result = await HaikangUtil.get_face_group() print(result) # 人脸分组1vN搜索 async def face_group_1vN_search_service(image_path): with open(image_path, 'rb') as f: image_data = f.read() encoded_image = base64.b64encode(image_data).decode('utf-8') result = await HaikangUtil.face_group_1vN_search( facePicBinaryData=encoded_image, pageNo=1, pageSize=10, searchNum=99, minSimilarity=50, faceGroupIndexCodes=['5dc82633-a4cb-4107-b55e-f21bf952f9'] ) print(result) # 人脸评分 async def face_picture_check(image_path): with open(image_path, 'rb') as f: image_data = f.read() encoded_image = base64.b64encode(image_data).decode('utf-8') result = await HaikangUtil.face_picture_check( facePicBinaryData=encoded_image ) print(result) # 查询访客预约记录 async def query_visitor_record(): result = await HaikangUtil.query_visitor_record() print(result) if __name__ == '__main__': # asyncio.run(get_door_list_service()) # print("*"*100) # asyncio.run(get_door_status_service(['D01'])) # print("*"*100) # asyncio.run(door_do_control_service(['D01'], 1)) # asyncio.run(query_door_events_service('D01',1,10,1640995200,1640995200)) # asyncio.run(get_face_group_service()) # image_path = "75c03e462769c81b6a8513d90ff2a27d.jpg" # asyncio.run(face_group_1vN_search_service(image_path)) # asyncio.run(face_picture_check(image_path)) # asyncio.run(query_visitor_record()) asyncio.run(door_online_status_service(["xxxxxxxx"]))