From 285f7d9110f534827e70388948be8a6cf817ba75 Mon Sep 17 00:00:00 2001 From: guke Date: Thu, 30 Jul 2026 19:09:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=9F=AD=E4=BF=A1):=20=E5=8F=B7=E7=A0=81?= =?UTF-8?q?=E6=97=A0=E6=95=88=E6=8F=90=E7=A4=BA=E7=94=B1=E3=80=8C=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7=E6=97=A0=E6=95=88=E3=80=8D=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E3=80=8C=E8=AF=B7=E8=BE=93=E5=85=A5=E6=9C=89=E6=95=88=E7=9A=84?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 极光/阿里云/创蓝三处 provider 的号码无效错误统一改成更友好的用户提示。 Co-Authored-By: Claude Opus 4.8 (1M context) --- app/integrations/sms/aliyun.py | 2 +- app/integrations/sms/chuanglan.py | 2 +- app/integrations/sms/jiguang.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/integrations/sms/aliyun.py b/app/integrations/sms/aliyun.py index 1b49842..9cd7be0 100644 --- a/app/integrations/sms/aliyun.py +++ b/app/integrations/sms/aliyun.py @@ -35,7 +35,7 @@ _GC_THRESHOLD = 10000 # 超此阈值,send 时顺手清老于 # 发码错误码 → (HTTP 码, 用户提示)。未列出的一律 503(供应商不可用)。 _SEND_ERRORS: dict[str, tuple[int, str]] = { - "MOBILE_NUMBER_ILLEGAL": (400, "手机号无效"), + "MOBILE_NUMBER_ILLEGAL": (400, "请输入有效的手机号"), "BUSINESS_LIMIT_CONTROL": (429, "今日发送次数过多,请明天再试"), "FREQUENCY_FAIL": (429, "发送过于频繁,请稍后再试"), } diff --git a/app/integrations/sms/chuanglan.py b/app/integrations/sms/chuanglan.py index c9328aa..b3afd28 100644 --- a/app/integrations/sms/chuanglan.py +++ b/app/integrations/sms/chuanglan.py @@ -53,7 +53,7 @@ _GC_THRESHOLD = 10000 # 任一内存 dict 超此阈值,send 时顺手清过期 # 发码错误码(创蓝 `code`)→ (HTTP 码, 用户提示)。未列出的一律 503(供应商不可用)。 _SEND_ERRORS: dict[str, tuple[int, str]] = { "103": (429, "发送过于频繁,请稍后再试"), # 提交速度过快 - "107": (400, "手机号无效"), # 手机号码错误 + "107": (400, "请输入有效的手机号"), # 手机号码错误 } # 需运维介入的配置/开通/余额类错误:打 critical 日志(仍归 503)。 _SEND_CRITICAL_CODES = frozenset({ diff --git a/app/integrations/sms/jiguang.py b/app/integrations/sms/jiguang.py index 336a141..7406963 100644 --- a/app/integrations/sms/jiguang.py +++ b/app/integrations/sms/jiguang.py @@ -185,5 +185,5 @@ def _send_via_jiguang(phone: str, code: str) -> None: if ecode == 50009: # 极光侧超频 raise SmsError("发送过于频繁,请稍后再试", status_code=429) if ecode == 50006: # 手机号无效(schema 已挡格式,这里多是空号/停机) - raise SmsError("手机号无效", status_code=400) + raise SmsError("请输入有效的手机号", status_code=400) raise SmsError(f"短信发送失败(code={ecode})", status_code=503) -- 2.52.0