喇叭播放修改

This commit is contained in:
曹前明 2022-09-01 17:33:20 +08:00
parent 3fb7abca32
commit 04ab299ecd
3 changed files with 12 additions and 10 deletions

View File

@ -126,7 +126,14 @@ class SpClient:
""" """
uri = path uri = path
if not uri.startswith('http'): 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 = { json = {
"sns": sns, "sns": sns,
"type": "req", "type": "req",
@ -134,15 +141,10 @@ class SpClient:
"params": { "params": {
"tid": ranstr(6), "tid": ranstr(6),
"vol": 100, "vol": 100,
"urls": [{ "urls": urls
"name": "alarm.mp3",
"uri": uri
}]
} }
} }
while v_num > 0: self.request(**spapis['send_to_device'], json=json)
self.request(**spapis['send_to_device'], json=json)
v_num = v_num - 1
return return
def _get_response_ms(self): def _get_response_ms(self):

View File

@ -195,7 +195,6 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom
@action(methods=['post'], detail=False, perms_map={'post': '*'}, @action(methods=['post'], detail=False, perms_map={'post': '*'},
serializer_class=Serializer) serializer_class=Serializer)
@transaction.atomic
def vchannel_sync(self, request): 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 = TDevice(code=i['channelCode'], type=TDevice.DEVICE_VCHANNEL)
td.name = i['channelName'] td.name = i['channelName']
td.save() 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() return Response()
@action(methods=['post'], detail=False, perms_map={'post': '*'}, @action(methods=['post'], detail=False, perms_map={'post': '*'},

View File

@ -347,6 +347,7 @@ LOGGING = {
# 项目 # 项目
VERSION = '1.0.0' VERSION = '1.0.0'
BASE_URL = conf.BASE_URL BASE_URL = conf.BASE_URL
BASE_URL_IN = conf.BASE_URL_IN
# 大华ICC平台 # 大华ICC平台
DAHUA_ENABLED = conf.DAHUA_ENABLED DAHUA_ENABLED = conf.DAHUA_ENABLED