修复设备消耗查询问题

qrnn
youngS 3 years ago
parent 92ba4fc258
commit 49c35275b6
  1. 2
      fir_ser/api/views/supersign.py
  2. 16
      fir_ser/fir_ser/settings.py

@ -435,7 +435,7 @@ class DeviceUsedRankInfoView(APIView):
if end_time and start_time:
try:
start_time = datetime.date.fromtimestamp(int(start_time) / 1000)
end_time = datetime.date.fromtimestamp(int(end_time) / 1000 + 24 * 60 * 60 - 1)
end_time = datetime.date.fromtimestamp(int(end_time) / 1000) + datetime.timedelta(days=1)
app_used_sign_objs = app_used_sign_objs.filter(created_time__range=[start_time, end_time])
except Exception as e:
logger.error(f"get time range failed {e}")

@ -305,7 +305,7 @@ LOGGING = {
},
'handlers': {
'console': {
'level': 'INFO',
'level': 'DEBUG',
'filters': ['require_debug_true'], # 只有在Django debug为True时才在屏幕打印日志
'class': 'logging.StreamHandler',
'formatter': 'simple'
@ -347,6 +347,15 @@ LOGGING = {
'formatter': 'standard',
'encoding': 'utf-8',
},
'sql': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler', # 保存到文件,自动切
'filename': os.path.join(BASE_LOG_DIR, "flyapp_sql.log"), # 日志文件
'maxBytes': 1024 * 1024 * 5, # 日志大小 50M
'backupCount': 10,
'formatter': 'standard',
'encoding': 'utf-8',
},
},
'loggers': {
'': { # 默认的logger应用如下配置
@ -359,6 +368,11 @@ LOGGING = {
'level': 'DEBUG',
'propagate': True,
},
'django.db.backends': {
'handlers': ['console', 'sql'],
'propagate': True,
'level': 'DEBUG',
},
},
}

Loading…
Cancel
Save