fix: need_purchase 时微信回复文案不再误报"授权成功"

handle_scan() 原先只返回场景是否绑定成功,导致无可用授权的用户扫码后
微信里收到"授权成功"、而 MFC 轮询拿到 need_purchase,提示不一致。

改为返回 authorized / need_purchase / invalid 三种结果,与 /auth/status
的 status 取值保持一致,wechat.py 据此选择回复文案。
This commit is contained in:
gjm committed 2026-09-26 23:58:20 +08:00
1 parent ab1f2e68d3
commit a798fbad60
2 files changed
+22 -12

No files matched your search

+8 -4
View File
@@ -126,10 +126,14 @@ async def _handle_scan_event(
# 无场景值的普通关注
return _reply_text(from_user, to_user, "欢迎关注!")
authorized = await auth.handle_scan(scene_str, from_user)
if authorized:
return _reply_text(from_user, to_user, "授权成功,请返回电脑端继续操作。")
return _reply_text(from_user, to_user, "二维码已失效或已被使用,请在电脑端刷新后重新扫码。")
result = await auth.handle_scan(scene_str, from_user)
if result == "authorized":
reply = "授权成功,请返回电脑端继续操作。"
elif result == "need_purchase":
reply = "当前无可用授权,请返回电脑端按提示操作。"
else:
reply = "二维码已失效或已被使用,请在电脑端刷新后重新扫码。"
return _reply_text(from_user, to_user, reply)
def _parse_scene_key(event_key: str, is_subscribe: bool) -> str: