|
@@ -274,13 +274,25 @@ class IotCoreView(View):
|
|
|
UID = request_dict.get('UID', None)
|
|
|
rtsp = request_dict.get('rtsp', None)
|
|
|
enable = request_dict.get('enable', '1')
|
|
|
- if not all([UID, rtsp]):
|
|
|
+ command_type = request_dict.get('commandType', None)
|
|
|
+
|
|
|
+ logger = logging.getLogger('django')
|
|
|
+ logger.info(
|
|
|
+ f"[request_publish_message] 收到请求: UID={UID}, rtsp={rtsp}, enable={enable}, commandType={command_type}")
|
|
|
+
|
|
|
+ if not UID:
|
|
|
+ return response.json(444)
|
|
|
+ if not any([rtsp, command_type]):
|
|
|
return response.json(444)
|
|
|
|
|
|
try:
|
|
|
thing_name = CommonService.query_serial_with_uid(UID) # 存在序列号则为使用序列号作为物品名
|
|
|
topic_name = 'ansjer/generic/{}'.format(thing_name)
|
|
|
- msg = OrderedDict(
|
|
|
+
|
|
|
+ if command_type:
|
|
|
+ msg = {'commandType': command_type}
|
|
|
+ else:
|
|
|
+ msg = OrderedDict(
|
|
|
[
|
|
|
('alexaRtspCommand', rtsp),
|
|
|
('enable', int(enable)),
|