From 67c0777fc9cfe32e8834350d896b1f3cbe19a52e Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 16 Apr 2024 14:41:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=9F=E6=88=90envdata=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enp/tasks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/enp/tasks.py b/apps/enp/tasks.py index 4774818b..ab8fcc63 100644 --- a/apps/enp/tasks.py +++ b/apps/enp/tasks.py @@ -12,13 +12,12 @@ import random @shared_task(base=CustomTask) def generate_envdata(): """生成模拟数据""" - now = timezone.now() + now = timezone.now().replace(microsecond=0) eIds = DrainEquip.objects.values_list("equipment__id", flat=True) equips = Equipment.objects.filter(id__in=eIds) | Equipment.objects.filter(cate__code="aqms") save_list = [] for equip in equips: - default_dict = {"equipment": equip, "timex": now, "is_online": 1, "running_state": 10} - equip.is_online = 1 + default_dict = {"equipment": equip, "timex": now, "running_state": 10} equip.running_state = 10 equip.save() if equip.cate and equip.cate.code in ["cems", "aqms", "tsp"]: