Selaa lähdekoodia

修改query_push_day_statistics接口的凌晨时间计算逻辑

tanghongbin 4 vuotta sitten
vanhempi
commit
ef40500361
1 muutettua tiedostoa jossa 6 lisäystä ja 9 poistoa
  1. 6 9
      Controller/AdminManage.py

+ 6 - 9
Controller/AdminManage.py

@@ -463,15 +463,12 @@ class AdminManage(TemplateView):
 
     def query_push_day_statistics(self, level, response):
         start_time = 0
-        end_time = 0
-        # localtime = time.localtime()
-        # current_day = localtime.tm_mday
-        #
-        # time_struct = [localtime.tm_year, localtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0]
-        # current_time = int(time.mktime(tuple(time_struct)))
-        current_time = int(time.time())
-        count = int(current_time / (24 * 3600))
-        current_time = count * 24 * 3600 - 8 * 3600
+
+        gmtime = time.gmtime(int(time.time()) + 28800)
+        current_day = gmtime.tm_mday
+        time_struct = [gmtime.tm_year, gmtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0]
+        current_time = int(time.mktime(tuple(time_struct))) - 28800
+
         count = 0
         if level == 0: # 七天
             start_time = current_time - 6 * 24 * 3600