From e0915676e391bf5d17960f5ed2f21e27bbbce0a2 Mon Sep 17 00:00:00 2001 From: zty Date: Mon, 9 Dec 2024 09:46:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20enm/view=20service=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=81=9A=E5=90=88=E5=92=8C=E7=85=A4=E7=B2=89=E7=83=AD=E5=80=BC?= =?UTF-8?q?=20=E7=BC=93=E5=AD=98=E5=A4=B1=E6=95=88=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/views.py | 3 ++- apps/wpm/services.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/enm/views.py b/apps/enm/views.py index 9f45b06d..71fd3e4b 100644 --- a/apps/enm/views.py +++ b/apps/enm/views.py @@ -217,7 +217,8 @@ class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, CustomListM qs = self.filter_queryset(self.get_queryset()) group_by = request.query_params.get("group_by", "") group_by_list = group_by.split(",") - group_by_list.remove("") + if "" in group_by_list: + group_by_list.remove("") if 'mpoint' not in group_by_list: group_by_list.append('mpoint') qs = qs.values() diff --git a/apps/wpm/services.py b/apps/wpm/services.py index 37f1951a..d4a01587 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -131,7 +131,7 @@ def get_pcoal_heat(year_s: int, month_s: int, day_s: int): else: qs.pcoal_heat = 6000 qs.save(update_fields=['pcoal_heat']) - cache.set(key, qs.pcoal_heat, timeout=60 * 60 * 48) + cache.set(key, qs.pcoal_heat, timeout=60 * 60 * 8) return qs.pcoal_heat except Exception as e: myLogger.error(f'获取煤粉热值失败,{e}', exc_info=True)