feat: enm/view service 修改聚合和煤粉热值 缓存失效时间。

This commit is contained in:
zty 2024-12-09 09:46:51 +08:00
parent 1b3bfabd55
commit e0915676e3
2 changed files with 3 additions and 2 deletions

View File

@ -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()

View File

@ -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)