| 
					
				 | 
			
			
				@@ -12,7 +12,8 @@ from tqdm import tqdm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from datetime import datetime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from argparse import ArgumentParser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-from applications import PQMySQL, WeixinSpider, Functions, log, bot, aiditApi, longArticlesMySQL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from applications import PQMySQL, WeixinSpider, Functions, log, bot, aiditApi, longArticlesMySQL, \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    create_feishu_columns_sheet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from applications.const import updatePublishedMsgTaskConst 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ARTICLE_TABLE = "official_articles_v2" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -21,6 +22,22 @@ spider = WeixinSpider() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 functions = Functions() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def generate_bot_columns(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    生成列 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    :return: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    columns = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        create_feishu_columns_sheet(sheet_type="plain_text", sheet_name="name", display_name="公众号名称"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        create_feishu_columns_sheet(sheet_type="plain_text", sheet_name="ghId", display_name="ghId"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        create_feishu_columns_sheet(sheet_type="number", sheet_name="follower_count", display_name="粉丝数"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        create_feishu_columns_sheet(sheet_type="date", sheet_name="account_init_timestamp", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    display_name="账号接入系统时间"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        create_feishu_columns_sheet(sheet_type="plain_text", sheet_name="using_status", display_name="利用状态") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return columns 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 def get_account_using_status(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     获取正在 using 的 ghid 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,8 +64,11 @@ def get_accounts(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     using_account_set = get_account_using_status() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     account_list_with_out_using_status = aiditApi.get_publish_account_from_aigc() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # only_auto_reply_accounts_set = aiditApi.get_only_auto_reply_accounts() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     account_list = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for item in account_list_with_out_using_status: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # if item['account_id'] in only_auto_reply_accounts_set: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        #     continue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if item['ghId'] in using_account_set: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             item['using_status'] = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -420,16 +440,20 @@ def check_job(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for sub_item in tqdm(account_list): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         res = check_single_account(db_client, sub_item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if not res: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # 去掉三个不需要查看的字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sub_item.pop('account_type', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sub_item.pop('account_auth', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            init_timestamp = sub_item.pop('account_init_timestamp') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            sub_item['account_init_date'] = datetime.fromtimestamp(init_timestamp).strftime('%Y-%m-%d %H:%M:%S') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sub_item.pop('account_id', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             fail_list.append(sub_item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if fail_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             bot( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 title="日常报警, 存在账号更新失败", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                detail=fail_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                detail={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    "columns": generate_bot_columns(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    "rows": fail_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                table=True 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             print("Timeout Error: {}".format(e)) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -495,7 +519,7 @@ def update_publish_timestamp(db_client, row): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             root_source_id_list = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         publish_timestamp_s = const.REQUEST_FAIL_STATUS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        root_source_id_list = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        root_source_id_list = None 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         error_msg = traceback.format_exc() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         print(e, error_msg) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |