事件触发 区域名称bug

This commit is contained in:
曹前明 2022-08-25 16:26:53 +08:00
parent 86d22b478d
commit 1921015120
4 changed files with 29 additions and 3 deletions

View File

@ -87,7 +87,8 @@ def notify_event(event: Event, voice_msg=''):
# 生成通知文本
ep = event.employee
obj_cate = event.obj_cate
params = {'area': event.area.name, 'employee': '', 'event': ''}
area_name = event.area.name if event.area else ''
params = {'area': area_name, 'employee': '', 'event': ''}
if ep:
ep_name = ep.name
ep_type = '员工'

View File

@ -272,3 +272,24 @@ class DhClient:
"cascade": True
}
self.request(**dhapis['face_bind'], json=json_data)
def face_deploy(self):
params = {
"id": "001001001",
"checkStat": "1",
"type": "001;00_1;1",
"capability": "1_00000000000000000000000100000000",
"curCount": "0",
"isDomain": 0
}
_, res = self.request(**dhapis['dev_tree'], params=params)
for i in json.loads(res):
json_data = {
"minSimilarity": "70",
"dpMinSimilarity": 70,
"surveyType": ["1"],
"groups": str(settings.DAHUA_FACEGROUPID_1),
"chnId": i['id']
}
self.request(**dhapis['face_deploy'], json=json_data)

View File

@ -119,6 +119,10 @@ dhapis = {
"face_search": {
"url": "/evo-apigw/evo-face/faceSearch/third/faceSearchSync",
"method": "post"
},
"face_deploy": {
"url": "/evo-apigw/evo-face/channelGroup/add/batch",
"method": "post"
}
}

View File

@ -30,8 +30,8 @@ class DahuaTestView(MyLoggingMixin, APIView):
permission_classes = [IsAuthenticated]
def get(self, request, *args, **kwargs):
res = dhClient.face_search(path='/media/2022/07/13/three.jpg')
# res = dhClient.face_search(path='/media/2022/07/13/three.jpg')
res = dhClient.face_deploy()
return Response(res)