大华通用调用接口bug

This commit is contained in:
曹前明 2022-06-27 10:51:32 +08:00
parent a61594ef99
commit b52e623694
4 changed files with 15 additions and 5 deletions

View File

@ -38,7 +38,7 @@ class EcmService:
cls.rail_out(data=data.data)
elif data.type == 'onKeyAlarm':
# 一键呼救
pass
cls.one_key_alarm(data=data)
elif data.type == 'onOffLine':
if data.data.online:
# 标签定位在线
@ -48,7 +48,7 @@ class EcmService:
pass
elif data.type == 'lowpower':
# 低电量
pass
cls.low_power(data=data.data)
elif data.type == 'bltOnOffLineV2':
if data.data.online:
# 标签通信在线
@ -65,7 +65,7 @@ class EcmService:
area = Area.objects.filter(third_info__xx_rail__id=data['railId']).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 # 标签绑定人员
if ep_blt:
for i in Access.objects.filter(area=area).order_by('sort'):
@ -107,10 +107,18 @@ class EcmService:
else:
# 触发非法进入事件
pass
else:
elif area and (not blts):
# 触发未知标签进入事件
pass
@classmethod
def rail_out(cls, data):
pass
@classmethod
def low_power(cls, data):
pass
@classmethod
def one_key_alarm(cls, data):
pass

View File

@ -160,6 +160,7 @@ class OplSerializer(CustomModelSerializer):
fields = '__all__'
class OplCloseSerializer(CustomModelSerializer):
class Meta:
model = Opl

View File

@ -45,6 +45,7 @@ class OplViewSet(CustomModelViewSet):
update_serializer_class = OplCreateUpdateSerializer
serializer_class = OplSerializer
select_related_fields = ['cate']
filterset_fields = ['operation']
def destroy(self, request, *args, **kwargs):
obj = self.get_object()

View File

@ -136,7 +136,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
serializer.is_valid(raise_exception=True)
vdata = serializer.validated_data
if vdata.get('code', ''):
xxapi = xxapis.get(vdata['code'], None)
xxapi = dhapis.get(vdata['code'], None)
if xxapi is None:
raise ParseError(**TAPI_CODE_WRONG)
vdata['url'] = xxapi['url']