luojunhui преди 4 месеца
родител
ревизия
e5d2c3ce56
променени са 1 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 6 6
      updateAccountV3.py

+ 6 - 6
updateAccountV3.py

@@ -130,14 +130,14 @@ class UpdateAccountInfoVersion3(object):
         account_list = self.get_publishing_accounts()
         rate_dict = self.get_account_position_read_rate(dt)
         for account in tqdm(account_list, desc=dt):
-            business_type = self.const.TOULIU if account[
-                                                     'gh_id'] in self.const.TOULIU_ACCOUNTS else self.const.ARTICLES_DAILY
-            fans = fans_dict.get(account['gh_id'], {}).get(dt, 0)
+            gh_id = account["gh_id"]
+            business_type = self.const.TOULIU if gh_id in self.const.TOULIU_ACCOUNTS else self.const.ARTICLES_DAILY
+            fans = fans_dict.get(gh_id, {}).get(dt, 0)
             if not fans:
-                fans = int(unauthorized_account.get(account['gh_id'], 0))
+                fans = int(unauthorized_account.get(gh_id, 0))
             if fans:
                 for index in range(1, 9):
-                    gh_id_position = "{}_{}".format(account['gh_id'], index)
+                    gh_id_position = "{}_{}".format(gh_id, index)
                     if rate_dict.get(gh_id_position):
                         rate = rate_dict[gh_id_position]
                         read_avg = fans * rate
@@ -152,7 +152,7 @@ class UpdateAccountInfoVersion3(object):
                             self.pq.update(
                                 sql=insert_sql,
                                 params=(
-                                    account['gh_id'],
+                                    gh_id,
                                     index,
                                     dt,
                                     account['account_name'],