feat: enm/view service 修改聚合和煤粉热值 缓存失效时间。
This commit is contained in:
parent
1b3bfabd55
commit
e0915676e3
|
@ -217,7 +217,8 @@ class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, CustomListM
|
||||||
qs = self.filter_queryset(self.get_queryset())
|
qs = self.filter_queryset(self.get_queryset())
|
||||||
group_by = request.query_params.get("group_by", "")
|
group_by = request.query_params.get("group_by", "")
|
||||||
group_by_list = group_by.split(",")
|
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:
|
if 'mpoint' not in group_by_list:
|
||||||
group_by_list.append('mpoint')
|
group_by_list.append('mpoint')
|
||||||
qs = qs.values()
|
qs = qs.values()
|
||||||
|
|
|
@ -131,7 +131,7 @@ def get_pcoal_heat(year_s: int, month_s: int, day_s: int):
|
||||||
else:
|
else:
|
||||||
qs.pcoal_heat = 6000
|
qs.pcoal_heat = 6000
|
||||||
qs.save(update_fields=['pcoal_heat'])
|
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
|
return qs.pcoal_heat
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
myLogger.error(f'获取煤粉热值失败,{e}', exc_info=True)
|
myLogger.error(f'获取煤粉热值失败,{e}', exc_info=True)
|
||||||
|
|
Loading…
Reference in New Issue