Explorar o código

更新 'monitor/GA_Daily.py'

miacheng913 %!s(int64=3) %!d(string=hai) anos
pai
achega
a37297cad0
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      monitor/GA_Daily.py

+ 7 - 4
monitor/GA_Daily.py

@@ -38,9 +38,9 @@ headers = {
 
 com_table = []
 def creat_table():
-  for i in range(0,23):
+  for i in range(0,24):
     com_table.append([i,2300*i])
-  com_table.append([23,56000])
+  com_table.append([24,56000])
   print(com_table)
 
 def send_msg(kw):
@@ -49,11 +49,14 @@ def send_msg(kw):
     hour = datetime.now().strftime('%H') 
     # 判斷是否達標
     complet="否"
-    for i in range(0,24):
-      if int(hour)==com_table[i][0]:
+    for i in range(0,25):
+      if int(hour)+1==com_table[i][0]:
         print(i)
         if int(kw) > com_table[i][1] : 
           complet="是"
+      elif int(hour) == 24:
+        if int(kw) > 56000 : 
+          complet="是"
     params = {"message": "\n現在時間: " + current_time + "\n當前pageViews: "+kw + "\n是否達標: " + complet}  
     print(params)
     r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)