diff --git a/YYB/YYB_HSY.py b/YYB/YYB_HSY.py index 612d023..91be740 100644 --- a/YYB/YYB_HSY.py +++ b/YYB/YYB_HSY.py @@ -288,33 +288,104 @@ def notify(lines): print(f"[通知] 发送失败(不影响任务):{exc}") +def build_notify(accounts): + """按精简跳行版式渲染通知:汇总行 + 每账号(昵称/余额/已跑/未跑),账户间空行。""" + ok_n = sum(1 for a in accounts if a["success"]) + fail_n = len(accounts) - ok_n + content = f"""♻️ 回收猿签到 · {time.strftime('%Y-%m-%d %H:%M')} +✅ {ok_n} 成功 / {fail_n} 失败 +""" + for a in accounts: + if a["success"]: + content += f""" +▸ {a['label']} +✅ 奖励金 {a['balance']:.2f} 元 +""" + if a["done"]: + content += f"已跑: {'、'.join(a['done'])}\n" + if a["pending"]: + content += f"未跑: {'、'.join(a['pending'])}\n" + else: + content += f""" +▸ {a['label']} +❌ 失败 +原因: {(a['error'] or '未知错误').strip()} +""" + content += "\n" + return content.strip() + + def run_one(index, server, ref, nick, context): + """运行单个账号;返回 (日志行列表, 通知摘要 dict)。""" label = nick or f"YYB {ref}" result = [f"账号 {index}({label})"] + summary = {"label": label, "success": True, "balance": None, + "error": None, "done": [], "pending": []} session = requests.Session() session.headers.update({"User-Agent": "Mozilla/5.0 MicroMessenger/7.0.20.1781 MiniProgramEnv/Windows"}) try: username = login(session, server, ref, context) initial, _ = center(session, username) result.append(f"初始奖励金:{initial:.2f} 元") - result.append(sign_in(session, username)) - result.append(lucky_draw(session, username)) - result.extend(join_zero_event(session, username)) + summary["balance"] = initial + + msg = sign_in(session, username) + result.append(msg) + if "成功" in msg or "已签到" in msg: + summary["done"].append("签到") + else: + summary["error"] = msg + summary["success"] = False + + msg = lucky_draw(session, username) + result.append(msg) + if "无可用次数" in msg: + summary["pending"].append("幸运抽奖") + elif "失败" in msg: + summary["error"] = msg + summary["success"] = False + else: + summary["done"].append("幸运抽奖") + + msgs = join_zero_event(session, username) + result.extend(msgs) + for m in msgs: + if "参加成功" in m or "已参加" in m: + summary["done"].append("0元夺宝") + elif "失败" in m: + if summary["error"] is None: + summary["error"] = m + summary["success"] = False + else: + summary["pending"].append("0元夺宝") + time.sleep(1) final, _ = center(session, username) + summary["balance"] = final result.append(f"最终奖励金:{final:.2f} 元") - result.append(withdraw_all(session, username)) + + msg = withdraw_all(session, username) + result.append(msg) + if "跳过" in msg: + summary["pending"].append("提现") + elif "已发起" in msg or "已提交" in msg: + summary["done"].append("提现") + else: + summary["error"] = msg + summary["success"] = False except Exception as exc: result.append(f"失败:{exc}") + summary["error"] = str(exc) + summary["success"] = False print(" | ".join(result)) - return result + return result, summary def main(): context = bind_context() - output = ["回收猿:超过 1.00 元时尝试一次全额提现"] skip = blacklist() routes_list = routes() + accounts = [] ran = False for index, (server, ref, nick) in enumerate(routes_list, 1): label = nick or f"YYB {ref}" @@ -325,9 +396,10 @@ def main(): delay = random.randint(5, 20) print(f"[延迟] {delay} 秒后运行下一个账号") time.sleep(delay) - output.extend(run_one(index, server, ref, nick, context)) + _, summary = run_one(index, server, ref, nick, context) + accounts.append(summary) ran = True - notify(output) + notify(build_notify(accounts)) if __name__ == "__main__":