diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index fc0a1731..dace7337 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -141,7 +141,7 @@ def cal_mpointstats(is_now=1, year=None, month=None, day=None, hour=None): """ 计算所有自动采集测点的统计值,默认当前小时, 可手动传入时间 """ - if year and month and day and hour: + if year and month and day and hour is not None: pass else: now, pre = get_current_and_previous_time() @@ -235,7 +235,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, mgroup = Mgroup.objects.get(id=mgroupId) if sflogId: sflog = SfLog.objects.get(id=sflogId) - elif year and month and day and hour: + elif year and month and day and hour is not None: mytz = tz.gettz(settings.TIME_ZONE) dt = datetime.datetime(year=year, month=month, day=day, hour=hour, tzinfo=mytz) sflog = SfLog.objects.get(start_time__lt=dt, end_time__gte=dt, mgroup=mgroup)