大华事件分流
This commit is contained in:
parent
259b2cd38f
commit
6f596d9949
|
@ -270,18 +270,51 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
"param": {
|
"param": {
|
||||||
"monitors": [
|
"monitors": [
|
||||||
{
|
{
|
||||||
"monitor": settings.BASE_URL + '/api/third/dahua/mq/',
|
"monitor": settings.BASE_URL + '/api/third/dahua/c_swip/',
|
||||||
"monitorType": "url",
|
"monitorType": "url",
|
||||||
"events": [
|
"events": [
|
||||||
# {
|
|
||||||
# "category": "business",
|
|
||||||
# },
|
|
||||||
{
|
{
|
||||||
"category": "alarm",
|
"category": "alarm",
|
||||||
|
"subscribeAll": 1,
|
||||||
|
"domainSubscribe": 2,
|
||||||
|
"authorities": [
|
||||||
|
{
|
||||||
|
"types": ["42", "43", "44", "45", "46", "48", "49", "51", "52", "53",
|
||||||
|
"54", "55", "56", "57", "61", "62", "1420", "1425", "1430",
|
||||||
|
"1433", "1434", "1435", "1436", "1437", "1438",
|
||||||
|
"1439", "1441", "1442", "1443", "1448", "1449",
|
||||||
|
"1450", "1455", "1456", "1461", "1462", "1463",
|
||||||
|
"1464", "1467", "1468", "1469", "1470", "1471",
|
||||||
|
"1472", "1473", "1474", "1475", "1476", "1487",
|
||||||
|
"1488", "1489", "1490", "1491", "1492", "1493",
|
||||||
|
"1494", "1667", "4603", "4604", "4626", "4627",
|
||||||
|
"4632", "4633"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"monitor": settings.BASE_URL + '/api/third/dahua/c_monitor/',
|
||||||
|
"monitorType": "url",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"category": "alarm",
|
||||||
|
"subscribeAll": 1,
|
||||||
|
"domainSubscribe": 2,
|
||||||
|
"authorities": [
|
||||||
|
{
|
||||||
|
"types": ["302", "303", "305", "306", "307", "309", "311", "313", "314", "316",
|
||||||
|
"319", "326", "564", "574", "575", "577",
|
||||||
|
"578", "586", "587", "594", "596", "597",
|
||||||
|
"613", "614", "639", "665", "672", "675",
|
||||||
|
"819", "822", "823", "824", "826", "828",
|
||||||
|
"861", "873", "881", "882", "888", "962",
|
||||||
|
"963", "964", "965", "972", "973", "974",
|
||||||
|
"980", "981", "989"]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
# {
|
|
||||||
# "category": "state",
|
|
||||||
# }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -310,30 +343,27 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
@action(methods=['post'], detail=False,
|
@action(methods=['post'], detail=False,
|
||||||
authentication_classes=[], permission_classes=[],
|
authentication_classes=[], permission_classes=[],
|
||||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||||
def mq(self, request, pk=None):
|
def c_swip(self, request, pk=None):
|
||||||
"""大华事件处理
|
"""门禁事件
|
||||||
|
|
||||||
大华事件处理
|
门禁事件
|
||||||
"""
|
"""
|
||||||
# data = json.loads(request.body)
|
|
||||||
data = request.data
|
data = request.data
|
||||||
method = data['method']
|
method = data['method']
|
||||||
category = data['category']
|
category = data['category']
|
||||||
subsystem = data.get('subsystem', None)
|
subsystem = data.get('subsystem', None)
|
||||||
# info = data.get('info', {})
|
if method == 'alarm.msg' and subsystem == 'evo-accesscontrol':
|
||||||
if method == 'department.update':
|
|
||||||
pass
|
|
||||||
elif method == 'person.update':
|
|
||||||
pass
|
|
||||||
elif method == 'alarm.msg' and subsystem == 'evo-accesscontrol':
|
|
||||||
"""
|
|
||||||
刷卡事件
|
|
||||||
"""
|
|
||||||
HrmService.swipe(data=data)
|
HrmService.swipe(data=data)
|
||||||
elif category == 'alarm':
|
return Response()
|
||||||
|
|
||||||
|
@action(methods=['post'], detail=False,
|
||||||
|
authentication_classes=[], permission_classes=[],
|
||||||
|
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||||
|
def c_monitor(self, request, pk=None):
|
||||||
|
"""监控事件
|
||||||
|
|
||||||
|
监控事件
|
||||||
"""
|
"""
|
||||||
其他报警转到事件派发
|
data = request.data
|
||||||
"""
|
|
||||||
# myLogger.info(data)
|
|
||||||
dispatch_dahua_event(data=data)
|
dispatch_dahua_event(data=data)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
Loading…
Reference in New Issue