|
@@ -2,6 +2,7 @@
|
|
|
@author: luojunhui
|
|
|
cal each account && position reading rate
|
|
|
"""
|
|
|
+import json
|
|
|
from tqdm import tqdm
|
|
|
from pandas import DataFrame
|
|
|
from argparse import ArgumentParser
|
|
@@ -9,8 +10,11 @@ from datetime import datetime
|
|
|
|
|
|
from applications import DeNetMysql, PQMySQL, longArticlesMySQL, bot, Functions
|
|
|
from applications.const import updateAccountReadRateTaskConst
|
|
|
+from config import apolloConfig
|
|
|
|
|
|
const = updateAccountReadRateTaskConst()
|
|
|
+config = apolloConfig()
|
|
|
+unauthorized_account = json.loads(config.getConfigValue("unauthed_account_fans"))
|
|
|
functions = Functions()
|
|
|
read_rate_table = "long_articles_read_rate"
|
|
|
|
|
@@ -88,7 +92,7 @@ def get_publishing_accounts(db_client) -> list[dict]:
|
|
|
WHERE
|
|
|
t1.plan_status = 1
|
|
|
AND t3.channel = 5
|
|
|
- AND t3.follower_count > 0
|
|
|
+ -- AND t3.follower_count > 0
|
|
|
GROUP BY t3.id;
|
|
|
"""
|
|
|
account_list = db_client.select(sql)
|
|
@@ -145,6 +149,9 @@ def cal_account_read_rate(gh_id_tuple) -> DataFrame:
|
|
|
gh_id = line['ghId']
|
|
|
dt = functions.timestamp_to_str(timestamp=line['publish_timestamp'], string_format='%Y-%m-%d')
|
|
|
fans = fans_dict_each_day.get(gh_id, {}).get(dt, 0)
|
|
|
+ if not fans:
|
|
|
+ account_name = line['accountName']
|
|
|
+ fans = int(unauthorized_account.get(account_name, 0))
|
|
|
line['fans'] = fans
|
|
|
if fans > 1000:
|
|
|
line['readRate'] = line['show_view_count'] / fans if fans else 0
|