|
@@ -87,6 +87,8 @@ class UidSetView(View):
|
|
|
return self.do_update_set(request, request_dict, response)
|
|
|
elif operation == 'updateChannel':
|
|
|
return self.do_update_channel_set(request_dict, response)
|
|
|
+ elif operation == 'setVoicePrompt':
|
|
|
+ return self.do_set_voice(userID, request_dict, response)
|
|
|
# elif operation == 'test':
|
|
|
# return self.do_test(response)
|
|
|
else:
|
|
@@ -410,6 +412,78 @@ class UidSetView(View):
|
|
|
else:
|
|
|
return response.json(0)
|
|
|
|
|
|
+ def do_set_voice(self, userID, request_dict, response):
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ channel = request_dict.get('channel', None)
|
|
|
+ enter_voice = request_dict.get('enter_voice', None)
|
|
|
+ leave_voice = request_dict.get('leave_voice', None)
|
|
|
+ voice_status = request_dict.get('voice_status', None)
|
|
|
+ intelligent_mute = request_dict.get('intelligent_mute', None)
|
|
|
+ start_x = request_dict.get('start_x', None)
|
|
|
+ start_y = request_dict.get('start_y', None)
|
|
|
+ end_x = request_dict.get('end_x', None)
|
|
|
+ end_y = request_dict.get('end_y', None)
|
|
|
+ start_time = request_dict.get('start_time', None)
|
|
|
+ end_time = request_dict.get('end_time', None)
|
|
|
+ repeat_day = request_dict.get('repeat_day', None)
|
|
|
+ direction = request_dict.get('direction', None)
|
|
|
+
|
|
|
+ if uid and channel:
|
|
|
+ channel = int(channel)
|
|
|
+ if channel < 1:
|
|
|
+ return response.json(444, 'channel')
|
|
|
+ try:
|
|
|
+ ucs = {}
|
|
|
+ if enter_voice:
|
|
|
+ ucs['voice_prompt_enter'] = enter_voice
|
|
|
+
|
|
|
+ if leave_voice:
|
|
|
+ ucs['voice_prompt_leave'] = leave_voice
|
|
|
+
|
|
|
+ if voice_status:
|
|
|
+ ucs['voice_prompt_status'] = voice_status
|
|
|
+
|
|
|
+ if intelligent_mute:
|
|
|
+ ucs['voice_prompt_intelligent_mute'] = intelligent_mute
|
|
|
+
|
|
|
+ if start_x:
|
|
|
+ ucs['voice_start_x'] = start_x
|
|
|
+
|
|
|
+ if start_y:
|
|
|
+ ucs['voice_start_y'] = start_y
|
|
|
+
|
|
|
+ if end_x:
|
|
|
+ ucs['voice_end_x'] = end_x
|
|
|
+
|
|
|
+ if end_y:
|
|
|
+ ucs['voice_end_y'] = end_y
|
|
|
+
|
|
|
+ if start_time:
|
|
|
+ ucs['voice_start_time'] = start_time
|
|
|
+
|
|
|
+ if end_time:
|
|
|
+ ucs['voice_end_time'] = end_time
|
|
|
+
|
|
|
+ if repeat_day:
|
|
|
+ ucs['voice_repeat_day'] = repeat_day
|
|
|
+
|
|
|
+ if direction:
|
|
|
+ ucs['voice_direction'] = direction
|
|
|
+
|
|
|
+ uid_channel_set_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
|
|
|
+ if not uid_channel_set_qs.exists():
|
|
|
+ uidObject = UidSetModel.objects.filter(uid=uid)
|
|
|
+ ucs['channel'] = channel
|
|
|
+ ucs['uid'] = uidObject[0]
|
|
|
+ UidChannelSetModel.objects.create(**ucs)
|
|
|
+ else:
|
|
|
+ uid_channel_set_qs.update(**ucs)
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(177, repr(e))
|
|
|
+ else:
|
|
|
+ return response.json(0)
|
|
|
+
|
|
|
# def do_test(self, response):
|
|
|
# di_qs = Device_Info.objects.values('Type').annotate(c=Count('UID', distinct=True)).order_by()
|
|
|
# for di in di_qs:
|