From c88b41fd4666a43d5acb068ffe71a689cb2d2602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 1 Sep 2026 12:06:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(WxLoginController):=20=E4=BF=AE=E6=AD=A3=20?= =?UTF-8?q?getOrderQRCodeUnlimited=20=E6=8E=A5=E5=8F=A3=20scene=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整 scene 参数优先级为:显式 scene > 自定义页面使用原始 orderNo > 兼容原订单核销 scene=orderNo=xxx - 当传入页面参数时,scene 直接使用原始 orderNo,满足小程序端 options.scene 读取需求 - page 参数无传入时默认设置为 package/admin/order-scan,保持兼容旧版订单核销页面 - 保证原有订单核销逻辑和接口调用行为向下兼容无影响 --- .workbuddy/memory/2026-09-01.md | 7 +++++++ .../system/controller/WxLoginController.java | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .workbuddy/memory/2026-09-01.md diff --git a/.workbuddy/memory/2026-09-01.md b/.workbuddy/memory/2026-09-01.md new file mode 100644 index 0000000..376da76 --- /dev/null +++ b/.workbuddy/memory/2026-09-01.md @@ -0,0 +1,7 @@ +# 2026-09-01 工作记录 + +## 修复 getOrderQRCodeUnlimited scene 参数 bug +- 文件:`src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java` +- 问题:后台管理端调用 `/getOrderQRCodeUnlimited/e9?page=pages/event/detail/index` 时,因未传 `scene`,回退逻辑生成 `scene=orderNo=e9`,而 `pages/event/detail/index` 页面期望 `scene=e9`(直接读 options.scene)。 +- 修复:scene 取值优先级改为 `显式 scene > 自定义页面用原始 orderNo > 兼容原订单核销(orderNo=xxx)`;page 无参时默认 `package/admin/order-scan`。 +- 兼容性:原订单核销用法(不带参数)行为不变;自定义页面默认用原始 orderNo;需 `orderNo=` 格式可显式传 `?scene=orderNo=e9`。 diff --git a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java index 06eacda..50d0895 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java @@ -980,8 +980,18 @@ public class WxLoginController extends BaseController { } String apiUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + getAccessToken(loginUser.getTenantId()); final HashMap map = new HashMap<>(); - // scene 优先用入参,否则回退兼容原订单核销逻辑:orderNo=xxx - map.put("scene", StrUtil.isNotBlank(scene) ? scene : "orderNo=".concat(orderNo)); + // scene 优先级:显式 scene > 自定义页面用原始 orderNo > 兼容原订单核销(orderNo=xxx) + String sceneValue; + if (StrUtil.isNotBlank(scene)) { + sceneValue = scene; + } else if (StrUtil.isNotBlank(page)) { + // 自定义页面场景:小程序端通过 options.scene 直接读取业务值(如活动/订单号) + sceneValue = orderNo; + } else { + // 兼容原订单核销场景:scene=orderNo=xxx,默认跳转 package/admin/order-scan + sceneValue = "orderNo=".concat(orderNo); + } + map.put("scene", sceneValue); // page 优先用入参,否则回退兼容原订单核销页面 map.put("page", StrUtil.isNotBlank(page) ? page : "package/admin/order-scan"); map.put("env_version", "trial");