更新 YYB/YYB_BJY.py

This commit is contained in:
2026-10-05 23:07:18 +08:00
parent b1e28c5b92
commit aeb10c60de
+70 -30
View File
@@ -43,6 +43,7 @@ import hashlib
import json import json
import os import os
import random import random
import re
import sys import sys
import time import time
import traceback import traceback
@@ -1266,43 +1267,82 @@ def run_account(index: int, total: int, server: str) -> Dict[str, Any]:
return result return result
def _compact_balance(balance: str) -> str:
"""精简余额:现金为 0.00 元时省略,只保留鲸币。"""
if not balance or balance == "-":
return balance
if "现金 0.00 元" in balance:
return balance.split(" / 现金 0.00 元")[0]
return balance
def summarize_tasks(res: Dict[str, Any]) -> Tuple[List[str], List[str]]:
"""从各任务消息中提取「已跑/未跑」简要标签(通知用,详情留在运行日志)。"""
done: List[str] = []
pending: List[str] = []
sign = res.get("signMsg") or ""
if "已签到" in sign or "签到成功" in sign:
done.append("签到")
welfare = res.get("welfareMsg") or ""
if "已处理" in welfare and "成功" in welfare:
done.append("收藏")
growth = res.get("growthMsg") or ""
if "发帖" in growth and "成功" in growth:
done.append("发帖")
if "完成旧衣回收" in growth or "完成回收旧书" in growth:
pending.append("回收")
if "邀请新用户" in growth or "购买商品" in growth:
pending.append("邀请/购买")
draw_task = res.get("drawTaskMsg") or ""
if "分享好友" in draw_task and "成功" in draw_task:
done.append("分享好友")
if "待真实动作" in draw_task:
pending.append("预约/捐赠/回复")
lottery = res.get("lotteryMsg") or ""
m = re.search(r"成功 (\d+) 次", lottery)
draws = int(m.group(1)) if m else 0
if draws > 0:
done.append(f"抽奖×{draws}")
else:
pending.append("抽奖(需真实动作)")
return done, pending
def build_notify(results: List[Dict[str, Any]]) -> str: def build_notify(results: List[Dict[str, Any]]) -> str:
success_count = sum(1 for item in results if item["success"]) success_count = sum(1 for item in results if item["success"])
fail_count = len(results) - success_count fail_count = len(results) - success_count
content = f"""♻️ 白鲸鱼旧衣服回收任务结果 content = f"""♻️ 白鲸鱼旧衣回收 · {now_text()}
✅ {success_count} 成功 / {fail_count} 失败
━━━━━━━━━━━━━━━━━━━━
🏁 总结:{success_count} 成功 / {fail_count} 失败
🕒 时间:{now_text()}
━━━━━━━━━━━━━━━━━━━━
""" """
for idx, res in enumerate(results, 1): for res in results:
icon = "✅" if res["success"] else "❌" name = ACCOUNT_NAMES.get(res.get("server") or "", res.get("server") or "-")
if res["success"]:
content += f""" content += f"""
🧩 账号 {idx} ▸ {name}
🌍 来源:{res["server"]} ✅ {_compact_balance(res.get("balance") or "-")}
🌐 代理:{res["proxyStatus"]}
📡 出口IP:{res["proxyIp"]}
🔐 Token:{res["token"]}
👤 用户:{res["username"]}
📝 签到:{res["signMsg"]}
🧧 福利:{res["welfareMsg"]}
🌱 成长:{res["growthMsg"]}
🎟️ 抽奖任务:{res["drawTaskMsg"]}
🎰 抽奖:{res["lotteryMsg"]}
💰 余额:{res["balance"]}
{icon} 结果:{"成功" if res["success"] else "失败"}
""" """
done, pending = summarize_tasks(res)
if done:
content += f"已跑: {'、'.join(done)}\n"
if pending:
content += f"未跑: {'、'.join(pending)}\n"
else:
content += f"""
▸ {name}
❌ 失败
原因: {(res.get('error') or '未知错误').strip()}
"""
content += "\n"
if not res["success"]: return content.strip()
content += f"❌ 原因:{res['error']}\n"
content += "━━━━━━━━━━━━━━━━━━━━\n"
return content
def parse_blacklist(value: str) -> set: def parse_blacklist(value: str) -> set:
@@ -1384,4 +1424,4 @@ def main() -> None:
if __name__ == "__main__": if __name__ == "__main__":
main() main()