浏览代码

修复v1查询消息列表接口

zhangdongming 1 年之前
父节点
当前提交
fca9db7371
共有 1 个文件被更改,包括 13 次插入15 次删除
  1. 13 15
      Controller/DetectController.py

+ 13 - 15
Controller/DetectController.py

@@ -26,13 +26,14 @@ from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, DETECT_PUSH
     JPUSH_CONFIG, FCM_CONFIG, APNS_CONFIG, \
     JPUSH_CONFIG, FCM_CONFIG, APNS_CONFIG, \
     BASE_DIR, APNS_MODE, SERVER_TYPE, LOGGER
     BASE_DIR, APNS_MODE, SERVER_TYPE, LOGGER
 from Ansjer.config import PUSH_REDIS_ADDRESS
 from Ansjer.config import PUSH_REDIS_ADDRESS
-from Model.models import Device_Info, VodHlsModel, Equipment_Info, UidSetModel, UidPushModel, SysMsgModel, \
+from Model.models import Device_Info, Equipment_Info, UidSetModel, UidPushModel, SysMsgModel, \
     VodBucketModel
     VodBucketModel
 from Object.ETkObject import ETkObject
 from Object.ETkObject import ETkObject
 from Object.RedisObject import RedisObject
 from Object.RedisObject import RedisObject
 from Object.ResponseObject import ResponseObject
 from Object.ResponseObject import ResponseObject
 from Object.TokenObject import TokenObject
 from Object.TokenObject import TokenObject
 from Object.UidTokenObject import UidTokenObject
 from Object.UidTokenObject import UidTokenObject
+from Object.utils import LocalDateTimeUtil
 from Service.CommonService import CommonService
 from Service.CommonService import CommonService
 from Service.EquipmentInfoService import EquipmentInfoService
 from Service.EquipmentInfoService import EquipmentInfoService
 from Service.VodHlsService import SplitVodHlsObject
 from Service.VodHlsService import SplitVodHlsObject
@@ -85,22 +86,19 @@ class DetectControllerView(View):
         startTime = request_dict.get('startTime', None)
         startTime = request_dict.get('startTime', None)
         endTime = request_dict.get('endTime', None)
         endTime = request_dict.get('endTime', None)
         eventType = request_dict.get('eventType', None)
         eventType = request_dict.get('eventType', None)
-        # qs = Equipment_Info.objects.filter(userID_id=userID).order_by('-eventTime')
-        # if startTime and endTime:
-        #     qs = qs.filter(eventTime__range=(startTime, endTime))
-        # if eventType:
-        #     qs = qs.filter(eventType=eventType)
+        uids = request_dict.get('uids', None)
         try:
         try:
-            if startTime and endTime:
-                qs, count = EquipmentInfoService.find_by_start_time_equipment_info(page, line, userID, startTime,
-                                                                                   endTime, eventType,
-                                                                                   request_dict.get('uids', None))
+            uid_list = []
+            if uids:
+                uid_list = uids.split(',')
 
 
-            else:
-                # 默认查询近七天消息推送
-                qs, count = EquipmentInfoService.get_equipment_info_week_all(page, line, userID, startTime, endTime,
-                                                                             eventType,
-                                                                             request_dict.get('uids', None))
+            if not startTime and not endTime:
+                # 默认查询近七天内数据
+                endTime = int(time.time())
+                startTime = LocalDateTimeUtil.get_before_days_timestamp(endTime, 7)
+
+            qs, count = EquipmentInfoService. \
+                union_equipment_info(userID, uid_list, eventType, startTime, endTime, page, line)
             logger.info('<<<|||分表查询结果count:{}'.format(count))
             logger.info('<<<|||分表查询结果count:{}'.format(count))
             uids = request_dict.get('uids', None)
             uids = request_dict.get('uids', None)
             if uids:
             if uids: