Parcourir la source

MOD:修改wechat_info 数据表

cxyu il y a 3 ans
Parent
commit
774fbdc37c
3 fichiers modifiés avec 12 ajouts et 11 suppressions
  1. 5 6
      wechat_action/login_ad.py
  2. 2 1
      wechat_action/sql_tools.py
  3. 5 4
      wechat_api/get_wechat_info.py

+ 5 - 6
wechat_action/login_ad.py

@@ -38,11 +38,11 @@ class LogIn:
         # prefs = {"profile.managed_default_content_settings.images": 2, 'permissions.default.stylesheet': 2}
         # options.add_experimental_option("prefs", prefs)
 
-        # driver = webdriver.Remote(
-        #     # command_executor='http://192.168.1.101:4444/wd/hub',
-        #     command_executor='http://118.31.53.105:4555/wd/hub',
-        #     options=options)
-        driver = webdriver.Chrome(options=options)
+        driver = webdriver.Remote(
+            # command_executor='http://192.168.1.101:4444/wd/hub',
+            command_executor='http://118.31.53.105:4555/wd/hub',
+            options=options)
+        # driver = webdriver.Chrome(options=options)
         driver.maximize_window()
         return driver
 
@@ -87,7 +87,6 @@ class LogIn:
             sql_session.commit()
         log_ad.driver.switch_to.window(log_ad.driver.window_handles[-1])
 
-
     def select_ad_master(self, service_name, wechat_name):
         logging.info('开始切换服务商')
         time.sleep(5)

+ 2 - 1
wechat_action/sql_tools.py

@@ -187,7 +187,8 @@ def get_plan_record(sql_session, user_id, service_name, wechat_name,
         other_info = other_info + '\n and typesetting_list.name="{}" \n'.format(plan_name)
 
     sql = '''
-        select foo.*,wechat_info.wechat_id_info from (select typesetting_list.user_id , typesetting_list.name,
+        select foo.*,concat(wechat_info.appid,'\n',wechat_info.wxname ) as wechat_id_info
+         from (select typesetting_list.user_id , typesetting_list.name,
         record_list.service_name ,record_list.wechat_name,
         typesetting_list.create_time,record_list.status,
         typesetting_list.typesetting 

+ 5 - 4
wechat_api/get_wechat_info.py

@@ -112,17 +112,18 @@ class WechatApi():
             _get_human_info(self, service_name=service_name)
             self.service_loop(_get_human_info, {'self': self, 'service_name': service_name})
             self.log_ad.cookies_save(self.log_ad)
-            return self.human_info_list
+            return {'sucess': True, 'result_info': '', "result_list": self.human_info_list}
         except Exception as e:
             logging.error(str(e))
-            if err_num<3:
-                self.human_info_list=[]
+            if err_num < 3:
+                self.human_info_list = []
                 return self.get_human_info(err_num=err_num + 1)
+            return {'sucess': False, 'result_info': str(e)}
 
     def service_loop(self, function, kwargs):
 
         def click_service_change():
-            self.driver.switch_to.window(self.driver.window_handles[-1])
+            # self.driver.switch_to.window(self.driver.window_handles[-1])
             WebDriverWait(self.driver, 10).until(
                 lambda x: self.driver.find_element_by_css_selector(
                     '#root > div > header > div > div.CoreLayout__account-2lIr0 > div'))