Explorar o código

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

tanghongbin %!s(int64=4) %!d(string=hai) anos
pai
achega
ef40500361
Modificáronse 1 ficheiros con 6 adicións e 9 borrados
  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):
     def query_push_day_statistics(self, level, response):
         start_time = 0
         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
         count = 0
         if level == 0: # 七天
         if level == 0: # 七天
             start_time = current_time - 6 * 24 * 3600
             start_time = current_time - 6 * 24 * 3600