|
@@ -19,7 +19,7 @@ class FwhDataRecycle:
|
|
|
|
|
|
PUBLISH_SUCCESS_STATUS = 2
|
|
|
|
|
|
- STAT_PERIOD = 3 * 24 * 3600
|
|
|
+ STAT_PERIOD = 2 * 24 * 3600
|
|
|
|
|
|
def __init__(self):
|
|
|
self.denet_client = DatabaseConnector(denet_config)
|
|
@@ -140,6 +140,7 @@ class SaveFwhDataToDatabase(FwhDataRecycle):
|
|
|
"""
|
|
|
fetch_response = self.piaoquan_client.fetch(fetch_query, cursor_type=DictCursor)
|
|
|
gh_id_list = [i['gzh_id'] for i in fetch_response]
|
|
|
+ gh_id_list = ['gh_5e543853d8f0']
|
|
|
return gh_id_list
|
|
|
|
|
|
def get_stat_published_articles(self, gh_id):
|
|
@@ -205,12 +206,12 @@ class FwhDataExportTemp(FwhDataRecycle):
|
|
|
|
|
|
def get_publish_articles(self):
|
|
|
sql = f"""
|
|
|
- select accountName, title, article_group, ItemIndex, show_view_count, from_unixtime(createTime, '%Y-%m-%d'), root_source_id_list
|
|
|
+ -- select accountName, title, article_group, ItemIndex, show_view_count, from_unixtime(createTime, '%Y-%m-%d'), root_source_id_list
|
|
|
+ select accountName, title, ItemIndex, from_unixtime(createTime, '%Y-%m-%d'), sum(show_view_count), root_source_id_list
|
|
|
from official_articles_v2
|
|
|
- where ghId in (
|
|
|
- select gzh_id from article_gzh_developer
|
|
|
- )
|
|
|
- and from_unixtime(publish_timestamp) between '2025-06-08' and '2025-06-09';
|
|
|
+ where accountName = '票圈精彩'
|
|
|
+ and from_unixtime(publish_timestamp) between '2025-06-07' and '2025-06-10'
|
|
|
+ group by accountName, title, ItemIndex;
|
|
|
"""
|
|
|
return self.piaoquan_client.fetch(query=sql, cursor_type=DictCursor)
|
|
|
|
|
@@ -220,7 +221,7 @@ class FwhDataExportTemp(FwhDataRecycle):
|
|
|
"""
|
|
|
root_source_id_tuple = tuple(json.loads(root_source_id_list))
|
|
|
query = f"""
|
|
|
- select sum(uv) as 'uv', sum(first_uv) as 'first_uv', sum(split_uv) as 'split_uv'
|
|
|
+ select sum(uv) as 'uv', sum(first_uv) as 'first_uv', sum(split_uv) as 'split_uv', sum(split0) as 'T+0_fission'
|
|
|
from changwen_data_rootsourceid
|
|
|
where root_source_id
|
|
|
in %s;
|
|
@@ -237,10 +238,11 @@ class FwhDataExportTemp(FwhDataRecycle):
|
|
|
article['uv'] = fission_info[0]['uv']
|
|
|
article['first_uv'] = fission_info[0]['first_uv']
|
|
|
article['split_uv'] = fission_info[0]['split_uv']
|
|
|
+ article['T+0_fission'] = fission_info[0]['T+0_fission']
|
|
|
L.append(article)
|
|
|
df = pd.DataFrame(L)
|
|
|
df.to_csv('temp.csv', index=False)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- FwhDataExportTemp().deal()
|
|
|
+ SaveFwhDataToDatabase().deal()
|