瀏覽代碼

更新 'monitor/GA_Daily.py'

miacheng913 3 年之前
父節點
當前提交
0336c4e194
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      monitor/GA_Daily.py

+ 6 - 3
monitor/GA_Daily.py

@@ -38,9 +38,9 @@ headers = {
 
 
 com_table = []
 com_table = []
 def creat_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([i,2300*i])
-  com_table.append([23,56000])
+  com_table.append([24,56000])
   print(com_table)
   print(com_table)
 
 
 def send_msg(kw):
 def send_msg(kw):
@@ -50,10 +50,13 @@ def send_msg(kw):
     # 判斷是否達標
     # 判斷是否達標
     complet="否"
     complet="否"
     for i in range(0,25):
     for i in range(0,25):
-      if int(hour)==com_table[i][0]:
+      if int(hour)+1==com_table[i][0]:
         print(i)
         print(i)
         if int(kw) > com_table[i][1] : 
         if int(kw) > com_table[i][1] : 
           complet="是"
           complet="是"
+      elif int(hour) == 24:
+        if int(kw) > 56000 : 
+          complet="是"
     params = {"message": "\n現在時間: " + current_time + "\n當前pageViews: "+kw + "\n是否達標: " + complet}  
     params = {"message": "\n現在時間: " + current_time + "\n當前pageViews: "+kw + "\n是否達標: " + complet}  
     print(params)
     print(params)
     r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
     r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)