|
@@ -28,6 +28,19 @@ def get_accounts_v1():
|
|
|
return subscription_account, server_account
|
|
|
|
|
|
|
|
|
+def get_account_using_status():
|
|
|
+ """
|
|
|
+ 获取正在 using 的 ghid
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ sql = "SELECT gh_id FROM long_articles_publishing_accounts WHERE is_using = 1;"
|
|
|
+ gh_id_tuple = PQMySQL().select(sql)
|
|
|
+ gh_id_list = [
|
|
|
+ i[0] for i in gh_id_tuple
|
|
|
+ ]
|
|
|
+ return set(gh_id_list)
|
|
|
+
|
|
|
+
|
|
|
def get_accounts():
|
|
|
"""
|
|
|
从 aigc 数据库中获取目前处于发布状态的账号
|
|
@@ -39,7 +52,15 @@ def get_accounts():
|
|
|
"account_type": line[4],
|
|
|
"account_auth": line[5]
|
|
|
"""
|
|
|
- account_list = aiditApi.get_publish_account_from_aigc()
|
|
|
+ using_account_set = get_account_using_status()
|
|
|
+ account_list_with_out_using_status = aiditApi.get_publish_account_from_aigc()
|
|
|
+ account_list = []
|
|
|
+ for item in account_list_with_out_using_status:
|
|
|
+ if item['ghId'] in using_account_set:
|
|
|
+ item['using_status'] = 1
|
|
|
+ else:
|
|
|
+ item['using_status'] = 0
|
|
|
+ account_list.append(item)
|
|
|
subscription_account = [i for i in account_list if i['account_type'] in {0, 1}]
|
|
|
server_account = [i for i in account_list if i['account_type'] == 2]
|
|
|
return subscription_account, server_account
|
|
@@ -55,7 +76,6 @@ def insert_each_msg(db_client, item, account_name, msg_list):
|
|
|
:return:
|
|
|
"""
|
|
|
gh_id = item['ghId']
|
|
|
- account_init_timestamp = item['account_init_timestamp']
|
|
|
for info in msg_list:
|
|
|
baseInfo = info.get("BaseInfo", {})
|
|
|
appMsgId = info.get("AppMsg", {}).get("BaseInfo", {}).get("AppMsgId", None)
|
|
@@ -83,7 +103,7 @@ def insert_each_msg(db_client, item, account_name, msg_list):
|
|
|
show_zs_count = show_stat.get("show_zs_count", 0)
|
|
|
show_pay_count = show_stat.get("show_pay_count", 0)
|
|
|
wx_sn = ContentUrl.split("&sn=")[1].split("&")[0] if ContentUrl else None
|
|
|
- status = 1 if int(time.time()) - account_init_timestamp > 14 * 24 * 3600 else 0
|
|
|
+ status = item['using_status']
|
|
|
info_tuple = (
|
|
|
gh_id,
|
|
|
account_name,
|