diff --git a/apps/third/views.py b/apps/third/views.py index 2de54e9a..0d101d78 100755 --- a/apps/third/views.py +++ b/apps/third/views.py @@ -51,7 +51,8 @@ class SpTestView(APIView): # return Response() # params = {"page": 1, "pageSize": 10000} # _, res = spClient.request(**spapis['device_list'], params=params) - _, res = spClient.speak(path='http://192.168.10.249/media/2022/09/01/test.mp3', sns=['ls20://020277AA7D06'], v_num=5) + _, res = spClient.speak(path='http://192.168.10.249:20309/media/2022/09/01/test.mp3', + sns=['ls20://020277AA7D06'], v_num=5) return Response(res) @@ -63,9 +64,9 @@ class XxTestView(APIView): def get(self, request, *args, **kwargs): json = { - "railId": "bc0ed1151524490589a9a519685f188f", - "type": "" - } + "railId": "bc0ed1151524490589a9a519685f188f", + "type": "" + } _, res = xxClient.request(**xxapis['rail_ibeacon_list'], json=json) return Response(res) # ok, res = xxClient.request( diff --git a/apps/third/views_d.py b/apps/third/views_d.py index 2479fb4e..6b601e26 100644 --- a/apps/third/views_d.py +++ b/apps/third/views_d.py @@ -183,7 +183,9 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom } _, res = spClient.request(**spapis['device_list'], params=params) rows = res['rows'] + t_l = [] for i in rows: + t_l.append(i['sn']) td = TDevice.objects.filter(code=i['sn']).first() if td: pass @@ -191,6 +193,7 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom td = TDevice(code=i['sn'], type=TDevice.DEVICE_SPEAKER) td.name = i['name'] td.save() + TDevice.objects.filter(type=TDevice.DEVICE_SPEAKER).exclude(code__in=t_l).delete() # 移除不需要的 return Response() @action(methods=['post'], detail=False, perms_map={'post': '*'},