feat(cmcc): 成功通知默认开启(每日签到明细报文)
默认成功也推送:标题 N/N 成功,正文每号一行(掩码+签到/已签/天数/奖励/转盘明细)。 CMCC_NOTIFY_ON_SUCCESS=0 可回到只推失败。失败推送补形态统计与诊断行。
This commit is contained in:
@@ -612,11 +612,18 @@ def main():
|
||||
print(lines[-1])
|
||||
print("形态统计: %s" % stats, flush=True)
|
||||
|
||||
# 通知策略:失败必推(带诊断);成功默认也推(每日明细签到报文)。
|
||||
# 想回到「只推失败」:环境变量 CMCC_NOTIFY_ON_SUCCESS=0
|
||||
want_success = os.environ.get("CMCC_NOTIFY_ON_SUCCESS", "1").strip() != "0"
|
||||
ok_n = sum(1 for rc, _ in results if rc == 0)
|
||||
if any(rc != 0 for rc, _ in results):
|
||||
send_notify("中国移动签到失败 %d/%d" % (sum(1 for rc, _ in results if rc != 0), len(results)),
|
||||
"\n".join(lines))
|
||||
elif os.environ.get("CMCC_NOTIFY_ON_SUCCESS", "").strip() == "1":
|
||||
send_notify("中国移动签到成功 %d/%d" % (len(results), len(results)), "\n".join(lines))
|
||||
title = "中国移动签到 %d/%d 成功(有失败)" % (ok_n, len(results))
|
||||
body = "\n".join(lines)
|
||||
body += "\n\n形态统计: %s" % stats
|
||||
body += "\n诊断: 64B→素材/会话死需重抓;88B→冷却期稍后自动重试;236B→通道异常;403/150→cURL损坏"
|
||||
send_notify(title, body)
|
||||
elif want_success:
|
||||
send_notify("中国移动签到成功 %d/%d" % (ok_n, len(results)), "\n".join(lines))
|
||||
|
||||
return max(rc for rc, _ in results) if results else 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user