Bläddra i källkod

增加神助物流

zooeytsai 2 år sedan
förälder
incheckning
206397069e
1 ändrade filer med 39 tillägg och 16 borttagningar
  1. 39 16
      INNNews/run_sheet_2.py

+ 39 - 16
INNNews/run_sheet_2.py

@@ -21,21 +21,42 @@ import dataset
 def run_once(pport, dockername):
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
     lst = []
-
+    
     cursor = db.query('select term, domain from seo.selected_kw')
     for c in cursor:
+        lst.append([c['term'], c['domain']])
+    
+    obj = random.choice(lst)
+    kw = obj[0]
+    domain = obj[1]
+    print(kw, domain)
+    
+    intval = os.system(f'python3 general_clickbot.py get --kw="{kw}" --domain="{domain}" --port="{str(pport)}"')
+    
+    print('執行完成genetal_clickbot')
+    
+    if intval == -1:
+        print('-1')
+        sys.exit()
 
-        lst.append([c['term'],c['domain']])
 
+def run_specific(pport, dockername):
+    db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
+    lst = []
+    
+    cursor = db.query('select term, domain from seo.selected_kw where client="神助物流"')
+    for c in cursor:
+        lst.append([c['term'], c['domain']])
+    
     obj = random.choice(lst)
     kw = obj[0]
     domain = obj[1]
-    print(kw,domain)
-
-    intval = os.system(f'python general_clickbot.py get --kw={kw} --domain={domain} --port={str(pport)}')
+    print(kw, domain)
+    
+    intval = os.system(f'python3 general_clickbot.py get --kw="{kw}" --domain="{domain}" --port="{str(pport)}"')
+    
+    print('執行完成genetal_clickbot')
     
-    print('執行genetal_clickbot')
-
     if intval == -1:
         print('-1')
         sys.exit()
@@ -44,24 +65,26 @@ def run_once(pport, dockername):
 class JParams(object):
     
     def get(self, port=9222):
-        print(port)
         while True:
             try:
                 os.system('docker container restart tiny1')
-                # os.system('docker container restart tiny2')
-                # os.system('docker container restart tiny3')
+                os.system('docker container restart tiny2')
+                os.system('docker container restart tiny3')
+                os.system('docker container restart tiny8')
                 time.sleep(1)
                 run_once(9922, 'tiny1')
-                # run_once(9923, 'tiny2')
-                # run_once(9924, 'tiny3')
-                
+                run_once(9923, 'tiny2')
+                run_once(9924, 'tiny3')
+                run_specific(9929, 'tiny8')
                 time.sleep(20)
-            
+                break
             except:
                 os.system('docker container restart tiny1')
                 time.sleep(15)
+    
+    def run(self):
+        run_once(9922, 'tiny1')
 
 
 if __name__ == '__main__':
-    fire.Fire(JParams)
-
+    fire.Fire(JParams)