feat: sync account priorities after rate changes
This commit is contained in:
@@ -64,6 +64,35 @@ def format_dingtalk_website_rate_changed(
|
||||
}
|
||||
|
||||
|
||||
def format_dingtalk_priority_changed(
|
||||
website_name: str, upstream_name: str, changed_at: str,
|
||||
updates: list[dict],
|
||||
) -> dict[str, Any]:
|
||||
success = sum(1 for u in updates if u.get("status") == "success")
|
||||
failed = sum(1 for u in updates if u.get("status") == "failed")
|
||||
skipped = sum(1 for u in updates if u.get("status") == "skipped")
|
||||
lines = [
|
||||
f"### 🔄 {website_name} 账号优先级变更",
|
||||
"",
|
||||
f"- **触发上游**:{upstream_name}",
|
||||
f"- **时间**:{changed_at}",
|
||||
f"- **摘要**:{success} 更新 / {failed} 失败 / {skipped} 跳过",
|
||||
"",
|
||||
]
|
||||
for u in updates:
|
||||
emoji = {"success": "✅", "failed": "❌", "skipped": "⏭️"}.get(u.get("status", ""), "➖")
|
||||
gid = u.get("group_id", "?")
|
||||
priority = u.get("new_priority", "—")
|
||||
lines.append(f"{emoji} `{gid}` → priority={priority}")
|
||||
return {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title": f"{website_name} 账号优先级变更",
|
||||
"text": "\n".join(lines),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def format_dingtalk_balance_low(
|
||||
upstream_name: str, balance: float, threshold: float, changed_at: str
|
||||
) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user