From aeb10c60deea6a0df30f2a02b29d35fc1f92512f Mon Sep 17 00:00:00 2001 From: timxx <3337598077@qq.com> Date: Mon, 5 Oct 2026 23:07:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20YYB/YYB=5FBJY.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YYB/YYB_BJY.py | 100 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/YYB/YYB_BJY.py b/YYB/YYB_BJY.py index 4ef7c70..07292ea 100644 --- a/YYB/YYB_BJY.py +++ b/YYB/YYB_BJY.py @@ -43,6 +43,7 @@ import hashlib import json import os import random +import re import sys import time import traceback @@ -1266,43 +1267,82 @@ def run_account(index: int, total: int, server: str) -> Dict[str, Any]: 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: success_count = sum(1 for item in results if item["success"]) fail_count = len(results) - success_count - content = f"""♻️ 白鲸鱼旧衣服回收任务结果 - -━━━━━━━━━━━━━━━━━━━━ -🏁 总结:{success_count} 成功 / {fail_count} 失败 -🕒 时间:{now_text()} -━━━━━━━━━━━━━━━━━━━━ + content = f"""♻️ 白鲸鱼旧衣回收 · {now_text()} +✅ {success_count} 成功 / {fail_count} 失败 """ - for idx, res in enumerate(results, 1): - icon = "✅" if res["success"] else "❌" - - content += f""" -🧩 账号 {idx} -🌍 来源:{res["server"]} -🌐 代理:{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 "失败"} + for res in results: + name = ACCOUNT_NAMES.get(res.get("server") or "", res.get("server") or "-") + if res["success"]: + content += f""" +▸ {name} +✅ {_compact_balance(res.get("balance") or "-")} """ + 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"]: - content += f"❌ 原因:{res['error']}\n" - - content += "━━━━━━━━━━━━━━━━━━━━\n" - - return content + return content.strip() def parse_blacklist(value: str) -> set: @@ -1384,4 +1424,4 @@ def main() -> None: if __name__ == "__main__": - main() + main() \ No newline at end of file