|
@@ -66,16 +66,16 @@ def get_accounts():
|
|
|
return subscription_account, server_account
|
|
|
|
|
|
|
|
|
-def insert_each_msg(db_client, item, account_name, msg_list):
|
|
|
+def insert_each_msg(db_client, account_info, account_name, msg_list):
|
|
|
"""
|
|
|
把消息数据更新到数据库中
|
|
|
- :param item:
|
|
|
+ :param account_info:
|
|
|
:param db_client:
|
|
|
:param account_name:
|
|
|
:param msg_list:
|
|
|
:return:
|
|
|
"""
|
|
|
- gh_id = item['ghId']
|
|
|
+ gh_id = account_info['ghId']
|
|
|
for info in msg_list:
|
|
|
baseInfo = info.get("BaseInfo", {})
|
|
|
appMsgId = info.get("AppMsg", {}).get("BaseInfo", {}).get("AppMsgId", None)
|
|
@@ -103,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 = item['using_status']
|
|
|
+ status = account_info['using_status']
|
|
|
info_tuple = (
|
|
|
gh_id,
|
|
|
account_name,
|
|
@@ -179,17 +179,17 @@ def insert_each_msg(db_client, item, account_name, msg_list):
|
|
|
continue
|
|
|
|
|
|
|
|
|
-def update_each_account(db_client, item, account_name, latest_update_time, cursor=None):
|
|
|
+def update_each_account(db_client, account_info, account_name, latest_update_time, cursor=None):
|
|
|
"""
|
|
|
更新每一个账号信息
|
|
|
- :param item:
|
|
|
+ :param account_info:
|
|
|
:param account_name:
|
|
|
:param cursor:
|
|
|
:param latest_update_time: 最新更新时间
|
|
|
:param db_client: 数据库连接信息
|
|
|
:return: None
|
|
|
"""
|
|
|
- gh_id = item['ghId']
|
|
|
+ gh_id = account_info['ghId']
|
|
|
response = WeixinSpider().update_msg_list(ghId=gh_id, index=cursor)
|
|
|
msg_list = response.get("data", {}).get("data", {})
|
|
|
if msg_list:
|
|
@@ -202,7 +202,7 @@ def update_each_account(db_client, item, account_name, latest_update_time, curso
|
|
|
if check_id == gh_id:
|
|
|
insert_each_msg(
|
|
|
db_client=db_client,
|
|
|
- item=item,
|
|
|
+ account_info=account_info,
|
|
|
account_name=account_name,
|
|
|
msg_list=msg_list
|
|
|
)
|
|
@@ -210,7 +210,7 @@ def update_each_account(db_client, item, account_name, latest_update_time, curso
|
|
|
next_cursor = response['data']['next_cursor']
|
|
|
return update_each_account(
|
|
|
db_client=db_client,
|
|
|
- item=item,
|
|
|
+ account_info=account_info,
|
|
|
account_name=account_name,
|
|
|
latest_update_time=latest_update_time,
|
|
|
cursor=next_cursor
|
|
@@ -261,20 +261,20 @@ def check_account_info(db_client, gh_id):
|
|
|
}
|
|
|
|
|
|
|
|
|
-def update_single_account(db_client, sub_item):
|
|
|
+def update_single_account(db_client, account_info):
|
|
|
"""
|
|
|
|
|
|
- :param sub_item:
|
|
|
+ :param account_info:
|
|
|
:param db_client:
|
|
|
:return:
|
|
|
"""
|
|
|
- gh_id = sub_item['ghId']
|
|
|
+ gh_id = account_info['ghId']
|
|
|
account_info = check_account_info(db_client, gh_id)
|
|
|
account_name = account_info['account_name']
|
|
|
update_time = account_info['update_time']
|
|
|
update_each_account(
|
|
|
db_client=db_client,
|
|
|
- item=sub_item,
|
|
|
+ account_info=account_info,
|
|
|
account_name=account_name,
|
|
|
latest_update_time=update_time
|
|
|
)
|