diff --git a/apps/third/speaker.py b/apps/third/speaker.py index d18e9173..b99cba3d 100644 --- a/apps/third/speaker.py +++ b/apps/third/speaker.py @@ -126,7 +126,14 @@ class SpClient: """ uri = path if not uri.startswith('http'): - uri = settings.BASE_URL + path + uri = settings.BASE_URL_IN + path + urls = [] + while v_num > 0: + urls.append({ + "name": "alarm.mp3", + "uri": uri + }) + v_num = v_num - 1 json = { "sns": sns, "type": "req", @@ -134,15 +141,10 @@ class SpClient: "params": { "tid": ranstr(6), "vol": 100, - "urls": [{ - "name": "alarm.mp3", - "uri": uri - }] + "urls": urls } } - while v_num > 0: - self.request(**spapis['send_to_device'], json=json) - v_num = v_num - 1 + self.request(**spapis['send_to_device'], json=json) return def _get_response_ms(self): diff --git a/apps/third/views_d.py b/apps/third/views_d.py index e0383ed5..dc289b2a 100644 --- a/apps/third/views_d.py +++ b/apps/third/views_d.py @@ -195,7 +195,6 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom @action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=Serializer) - @transaction.atomic def vchannel_sync(self, request): """同步视频通道 @@ -220,7 +219,7 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom td = TDevice(code=i['channelCode'], type=TDevice.DEVICE_VCHANNEL) td.name = i['channelName'] td.save() - TDevice.objects.filter(type=TDevice.DEVICE_VCHANNEL).exclude(code__in=i['channelCode']).delete() + TDevice.objects.filter(type=TDevice.DEVICE_VCHANNEL).exclude(code__in=t_l).delete() return Response() @action(methods=['post'], detail=False, perms_map={'post': '*'}, diff --git a/server/settings.py b/server/settings.py index 8601368d..b8ecbbfb 100755 --- a/server/settings.py +++ b/server/settings.py @@ -347,6 +347,7 @@ LOGGING = { # 项目 VERSION = '1.0.0' BASE_URL = conf.BASE_URL +BASE_URL_IN = conf.BASE_URL_IN # 大华ICC平台 DAHUA_ENABLED = conf.DAHUA_ENABLED