From b52e6236949e6ab1ed7f03be79db1e5a8b49e37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Mon, 27 Jun 2022 10:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=8D=8E=E9=80=9A=E7=94=A8=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ecm/service.py | 16 ++++++++++++---- apps/opm/serializers.py | 1 + apps/opm/views.py | 1 + apps/third/views.py | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/ecm/service.py b/apps/ecm/service.py index f869abf7..61714382 100644 --- a/apps/ecm/service.py +++ b/apps/ecm/service.py @@ -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 diff --git a/apps/opm/serializers.py b/apps/opm/serializers.py index c40e2785..0a8667ac 100644 --- a/apps/opm/serializers.py +++ b/apps/opm/serializers.py @@ -160,6 +160,7 @@ class OplSerializer(CustomModelSerializer): fields = '__all__' + class OplCloseSerializer(CustomModelSerializer): class Meta: model = Opl diff --git a/apps/opm/views.py b/apps/opm/views.py index 4ac9b4fe..cb387c19 100644 --- a/apps/opm/views.py +++ b/apps/opm/views.py @@ -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() diff --git a/apps/third/views.py b/apps/third/views.py index b8287f1b..e3dbda4b 100755 --- a/apps/third/views.py +++ b/apps/third/views.py @@ -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']