فهرست منبع

更新设备影子添加异常打印,使用测试服配置时不同步更新数据

locky 3 سال پیش
والد
کامیت
3b6a0d3043
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      Controller/ShadowController.py

+ 6 - 2
Controller/ShadowController.py

@@ -78,8 +78,11 @@ def update_device_shadow(request):
         logger = logging.getLogger('info')
         logger.info('使用配置: {}'.format(SERVER_TYPE))
         logger.info('data: {}'.format(request_dict.dict()))
-        if SERVER_TYPE != 'Ansjer.cn_formal_settings':
-            requests.post(url='http://shadow.zositechc.cn/deviceShadow/update', data=request_dict.dict(), timeout=2)
+
+        if SERVER_TYPE != 'Ansjer.test_settings':
+            if SERVER_TYPE != 'Ansjer.cn_formal_settings':  # 同步更新国内数据
+                requests.post(url='http://shadow.zositechc.cn/deviceShadow/update', data=request_dict.dict(), timeout=2)
+
         nowTime = int(time.time())
 
         # 重置按钮
@@ -181,4 +184,5 @@ def update_device_shadow(request):
             # 如果推送状态开启,返回推送url
             return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
     except Exception as e:
+        logger.info('更新设备影子异常: {}'.format(repr(e)))
         return JsonResponse(status=500, data={'update_shadow_error': repr(e)})