|
@@ -223,22 +223,22 @@ class AccountOpenRateAvgTask(AccountDataTask):
|
|
|
params_list=params_list
|
|
|
)
|
|
|
|
|
|
- def update_record(self, gh_id, date_str, index, open_rate_obj):
|
|
|
+ def update_record(self, gh_id, date_str, open_rate_obj):
|
|
|
avg_open_rate = open_rate_obj["avg_open_rate"]
|
|
|
update_sql = f"""
|
|
|
update account_avg_info_v3
|
|
|
set open_rate_avg = %s
|
|
|
- where gh_id = %s and position = %s and update_time = %s;
|
|
|
+ where gh_id = %s and update_time = %s;
|
|
|
"""
|
|
|
affected_rows = self.piaoquan_crawler_db_client.save(
|
|
|
update_sql,
|
|
|
params=(
|
|
|
- avg_open_rate, gh_id, index, date_str
|
|
|
+ avg_open_rate, gh_id, date_str
|
|
|
)
|
|
|
)
|
|
|
print(affected_rows)
|
|
|
|
|
|
- def get_account_open_rate(self, account_name, gh_id, date_str):
|
|
|
+ def get_account_open_rate(self, gh_id, date_str):
|
|
|
date_str_ = date_str.replace("-", "")
|
|
|
fetch_query = f"""
|
|
|
select
|
|
@@ -253,13 +253,12 @@ class AccountOpenRateAvgTask(AccountDataTask):
|
|
|
query=fetch_query, cursor_type=DictCursor
|
|
|
)[0]
|
|
|
# self.insert_record_into_database(gh_id=gh_id, date_str=date_str, open_rate_obj=res, account_name=account_name)
|
|
|
- for i in const.ARTICLE_INDEX_LIST:
|
|
|
- self.update_record(gh_id, date_str, i, res)
|
|
|
+ # for i in const.ARTICLE_INDEX_LIST:
|
|
|
+ self.update_record(gh_id, date_str, res)
|
|
|
|
|
|
def deal(self, date_str):
|
|
|
account_list = fetch_publishing_account_list(self.denet_db_client)
|
|
|
for account in tqdm(account_list):
|
|
|
gh_id = account["gh_id"]
|
|
|
- account_name = account["account_name"]
|
|
|
- self.get_account_open_rate(account_name, gh_id, date_str)
|
|
|
+ self.get_account_open_rate(gh_id, date_str)
|
|
|
|