|
@@ -19,26 +19,6 @@ mysql_helper = MySQLHelper(
|
|
|
webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/c09712a8-22cd-4bfa-93a5-30ae7b1db11b"
|
|
webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/c09712a8-22cd-4bfa-93a5-30ae7b1db11b"
|
|
|
|
|
|
|
|
|
|
|
|
|
-def df_to_feishu_table(df: pd.DataFrame) -> dict:
|
|
|
|
|
- """
|
|
|
|
|
- 将 pandas DataFrame 转换为飞书卡片表格组件
|
|
|
|
|
- """
|
|
|
|
|
- # 构建列定义
|
|
|
|
|
- columns = [{"name": col, "width": "auto"} for col in df.columns]
|
|
|
|
|
-
|
|
|
|
|
- # 构建行数据
|
|
|
|
|
- rows = []
|
|
|
|
|
- for _, row in df.iterrows():
|
|
|
|
|
- cells = [{"text": str(val)} for val in row.values]
|
|
|
|
|
- rows.append({"cells": cells})
|
|
|
|
|
-
|
|
|
|
|
- return {
|
|
|
|
|
- "tag": "table",
|
|
|
|
|
- "columns": columns,
|
|
|
|
|
- "rows": rows
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
def get_fish_pq_ip() -> List[str]:
|
|
def get_fish_pq_ip() -> List[str]:
|
|
|
sql = "select * from base_config where config_key = 'fish_pq_ip_list';"
|
|
sql = "select * from base_config where config_key = 'fish_pq_ip_list';"
|
|
|
result = mysql_helper.execute_query(sql)
|
|
result = mysql_helper.execute_query(sql)
|
|
@@ -54,6 +34,7 @@ def get_all_reference_by_db() -> List[Dict[str, Any]]:
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_card_json(msg: str):
|
|
def build_card_json(msg: str):
|
|
|
|
|
+ is_success = True if msg else False
|
|
|
return {
|
|
return {
|
|
|
"config": {},
|
|
"config": {},
|
|
|
"i18n_elements": {
|
|
"i18n_elements": {
|
|
@@ -66,7 +47,7 @@ def build_card_json(msg: str):
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"tag": "markdown",
|
|
"tag": "markdown",
|
|
|
- "content": f"```\n{msg}\n```" if msg else "全部同步成功",
|
|
|
|
|
|
|
+ "content": f"```\n{msg}\n```" if is_success else "全部同步成功",
|
|
|
"text_align": "left",
|
|
"text_align": "left",
|
|
|
"text_size": "normal"
|
|
"text_size": "normal"
|
|
|
}
|
|
}
|
|
@@ -76,13 +57,13 @@ def build_card_json(msg: str):
|
|
|
"zh_cn": {
|
|
"zh_cn": {
|
|
|
"title": {
|
|
"title": {
|
|
|
"tag": "plain_text",
|
|
"tag": "plain_text",
|
|
|
- "content": "Fish音频同步失败通知"
|
|
|
|
|
|
|
+ "content": "Fish音频同步完成通知"
|
|
|
},
|
|
},
|
|
|
"subtitle": {
|
|
"subtitle": {
|
|
|
"tag": "plain_text",
|
|
"tag": "plain_text",
|
|
|
"content": ""
|
|
"content": ""
|
|
|
},
|
|
},
|
|
|
- "template": "yellow"
|
|
|
|
|
|
|
+ "template": "green" if True else "yellow"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|