|
@@ -13,7 +13,7 @@ from django.views import View
|
|
|
from Ansjer.config import AWS_IOT_GETS3_PULL_CHINA_ID, AWS_IOT_GETS3_PULL_CHINA_SECRET, \
|
|
|
AWS_IOT_GETS3_PULL_FOREIGN_ID, AWS_IOT_GETS3_PULL_FOREIGN_SECRET, AWS_ARN, AWS_IOT_SES_ACCESS_CHINA_REGION, \
|
|
|
AWS_IOT_SES_ACCESS_FOREIGN_REGION_ASIA, AWS_IOT_SES_ACCESS_FOREIGN_REGION_EUROPE, \
|
|
|
- AWS_IOT_SES_ACCESS_FOREIGN_REGION_AMERICA, REGION_ID_LIST, ALEXA_DOMAIN
|
|
|
+ AWS_IOT_SES_ACCESS_FOREIGN_REGION_AMERICA, REGION_ID_LIST, ALEXA_DOMAIN, LOGGER
|
|
|
from Model.models import Device_Info, iotdeviceInfoModel, SerialNumberModel, UidSetModel
|
|
|
from Object.IOTCore.IotObject import IOTClient
|
|
|
from Object.ResponseObject import ResponseObject
|
|
@@ -274,13 +274,24 @@ 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.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)),
|