Ver código fonte

修改统计时间

tanghongbin 4 anos atrás
pai
commit
9618a5d0a2
1 arquivos alterados com 4 adições e 1 exclusões
  1. 4 1
      Controller/StatisticsController.py

+ 4 - 1
Controller/StatisticsController.py

@@ -157,7 +157,7 @@ def statistcsPushDay(request):
         return response.json(token.code)
 
     current_time = int(time.time())
-    count = int(current_time / (24 * 3600))
+    count = int((current_time + 8 * 3600) / (24 * 3600))
     end_time = count * 24 * 3600 - 8 * 3600
     start_time = end_time - 24 * 3600
     print(start_time)
@@ -206,16 +206,19 @@ def statistcsPushMonth(request):
 
     localtime = time.localtime()
     current_month = localtime.tm_mon
+    print(current_month)
 
     distance_time = 8 * 60 * 60
 
     time_struct = [localtime.tm_year, localtime.tm_mon, 1, 0, 0, 0, 0, 0, 0]
     start_time = int(time.mktime(tuple(time_struct)))
     start_time = start_time - time.timezone - distance_time
+    print(start_time)
 
     time_struct[1] = current_month + 1
     end_time = int(time.mktime(tuple(time_struct)))
     end_time = end_time - time.timezone - distance_time
+    print(end_time)
 
     eq_qs = EquipmentInfoExStatisticsModel.objects.filter(statistics_date__gte=start_time, statistics_date__lte=end_time, date_type=0)
     # 0:APNS推送,1:谷歌推送,2:极光推送