大华通用调用接口bug
This commit is contained in:
parent
a61594ef99
commit
b52e623694
|
|
@ -38,7 +38,7 @@ class EcmService:
|
||||||
cls.rail_out(data=data.data)
|
cls.rail_out(data=data.data)
|
||||||
elif data.type == 'onKeyAlarm':
|
elif data.type == 'onKeyAlarm':
|
||||||
# 一键呼救
|
# 一键呼救
|
||||||
pass
|
cls.one_key_alarm(data=data)
|
||||||
elif data.type == 'onOffLine':
|
elif data.type == 'onOffLine':
|
||||||
if data.data.online:
|
if data.data.online:
|
||||||
# 标签定位在线
|
# 标签定位在线
|
||||||
|
|
@ -48,7 +48,7 @@ class EcmService:
|
||||||
pass
|
pass
|
||||||
elif data.type == 'lowpower':
|
elif data.type == 'lowpower':
|
||||||
# 低电量
|
# 低电量
|
||||||
pass
|
cls.low_power(data=data.data)
|
||||||
elif data.type == 'bltOnOffLineV2':
|
elif data.type == 'bltOnOffLineV2':
|
||||||
if data.data.online:
|
if data.data.online:
|
||||||
# 标签通信在线
|
# 标签通信在线
|
||||||
|
|
@ -65,7 +65,7 @@ class EcmService:
|
||||||
area = Area.objects.filter(third_info__xx_rail__id=data['railId']).first()
|
area = Area.objects.filter(third_info__xx_rail__id=data['railId']).first()
|
||||||
# 找到进入对象
|
# 找到进入对象
|
||||||
blts = TDevice.objects.filter(code=data['userId']).first()
|
blts = TDevice.objects.filter(code=data['userId']).first()
|
||||||
if blts and blts.employee: # 如果是人
|
if area and blts and blts.employee: # 如果是人
|
||||||
ep_blt = blts.employee # 标签绑定人员
|
ep_blt = blts.employee # 标签绑定人员
|
||||||
if ep_blt:
|
if ep_blt:
|
||||||
for i in Access.objects.filter(area=area).order_by('sort'):
|
for i in Access.objects.filter(area=area).order_by('sort'):
|
||||||
|
|
@ -107,10 +107,18 @@ class EcmService:
|
||||||
else:
|
else:
|
||||||
# 触发非法进入事件
|
# 触发非法进入事件
|
||||||
pass
|
pass
|
||||||
else:
|
elif area and (not blts):
|
||||||
# 触发未知标签进入事件
|
# 触发未知标签进入事件
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def rail_out(cls, data):
|
def rail_out(cls, data):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def low_power(cls, data):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def one_key_alarm(cls, data):
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@ class OplSerializer(CustomModelSerializer):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OplCloseSerializer(CustomModelSerializer):
|
class OplCloseSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Opl
|
model = Opl
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ class OplViewSet(CustomModelViewSet):
|
||||||
update_serializer_class = OplCreateUpdateSerializer
|
update_serializer_class = OplCreateUpdateSerializer
|
||||||
serializer_class = OplSerializer
|
serializer_class = OplSerializer
|
||||||
select_related_fields = ['cate']
|
select_related_fields = ['cate']
|
||||||
|
filterset_fields = ['operation']
|
||||||
|
|
||||||
def destroy(self, request, *args, **kwargs):
|
def destroy(self, request, *args, **kwargs):
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
vdata = serializer.validated_data
|
vdata = serializer.validated_data
|
||||||
if vdata.get('code', ''):
|
if vdata.get('code', ''):
|
||||||
xxapi = xxapis.get(vdata['code'], None)
|
xxapi = dhapis.get(vdata['code'], None)
|
||||||
if xxapi is None:
|
if xxapi is None:
|
||||||
raise ParseError(**TAPI_CODE_WRONG)
|
raise ParseError(**TAPI_CODE_WRONG)
|
||||||
vdata['url'] = xxapi['url']
|
vdata['url'] = xxapi['url']
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue