Преглед изворни кода

日志设置保存文件大小,重置消息提醒

locky пре 4 година
родитељ
комит
935819d9be
2 измењених фајлова са 6 додато и 1 уклоњено
  1. 1 0
      AnsjerPush/formal_settings.py
  2. 5 1
      Controller/ShadowController.py

+ 1 - 0
AnsjerPush/formal_settings.py

@@ -196,6 +196,7 @@ LOGGING = {
             'level': 'INFO',
             'class': 'logging.handlers.TimedRotatingFileHandler',
             'filename': BASE_DIR + '/static/log/info/info.log',
+            'maxBytes': 1024 * 1024 * 5,  # 5 MB
             'backupCount': 30,
             'when': 'D',
             'formatter': 'standard',

+ 5 - 1
Controller/ShadowController.py

@@ -75,14 +75,18 @@ def update_device_shadow(request):
     is_reset = request_dict.get('is_reset', None)
     # 传1则重置设备信息
     if is_reset == '1':
-        # 重置语音提示
         logger = logging.getLogger('info')
         logger.info('设备重置')
+
+        # 重置语音提示
         uid_channel_qs = UidChannelSetModel.objects.filter(uid__uid=uid)
         if uid_channel_qs.exists():
             uid_channel_qs.update(voice_prompt_intelligent_mute=0, voice_prompt_status=0, voice_prompt_enter=0,
                            voice_prompt_leave=0)
 
+        # 重置消息提醒
+        Device_Info.filter(UID=uid).update(NotificationMode=0)
+
         # 删除uid_set数据
         UidSetModel.objects.filter(uid=uid).delete()