浏览代码

优化分表查询消息推送

zhangdongming 3 年之前
父节点
当前提交
aef2160e07
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Service/EquipmentInfoService.py

+ 3 - 2
Service/EquipmentInfoService.py

@@ -162,7 +162,6 @@ class EquipmentInfoService:
         # 获取七天前时间戳
         seven_days_before_time = LocalDateTimeUtil.get_before_days_timestamp(now_time, 7)
         # 默认查询当前表event_time大于七天前时间
-        qs = qs.filter(event_time__gt=seven_days_before_time)
         if user_id:
             qs = qs.filter(device_user_id=user_id)
         if event_type:
@@ -173,7 +172,9 @@ class EquipmentInfoService:
             else:
                 qs = qs.filter(event_type=event_type)
         if start_time and end_time:
-            qs = qs.filter(event_time__range=(start_time, end_time))
+            qs = qs.filter(event_time__range=(int(start_time), int(end_time)))
+        else:
+            qs = qs.filter(event_time__range=(seven_days_before_time, now_time))
         if uid_list:
             uid_list = uid_list.split(',')
             qs = qs.filter(device_uid__in=uid_list)