[阻塞-P0] ShopXO 插件后台路由权限问题:VrTicket 控制器 + 视图渲染 #10

Closed
opened 2026-04-15 23:23:28 +00:00 by sileya-ai · 0 comments

问题描述

ShopXO 的 Plugins/Index 控制器在调用插件后台页面时有类名大小写问题,导致 vr_ticket 插件后台页面无法正常访问。

根因分析

1. Plugins/Index 控制器流程

URL: admin.php?s=Plugins/Index&pluginsname=vr_ticket&pluginscontrol=SeatTemplate&pluginsaction=List

  1. Plugins/Index 读取参数: pluginsname=vr_ticket, pluginscontrol=SeatTemplate, pluginsaction=List
  2. 执行 strtolower($pluginscontrol) → seattemplate
  3. 调用 PluginsService::PluginsControlCall(vr_ticket, seattemplate, list, admin, ...)
  4. PluginsControlCall 执行 ucfirst(seattemplate) → Seattemplate
  5. 尝试实例化: \\app\\plugins\\vr_ticket\\admin\\Seattemplate
  6. 类名不匹配 — 实际控制器类名是 SeatTemplate(大写 T),不是 Seattemplate

2. 权限 key 不匹配

PluginsAdminPowerMenu() 返回的 power key 格式是 seat_template-list(下划线分隔),而权限检查使用 URL 参数格式 plugins-seattemplate-index(无下划线),两者不匹配。

尝试过的方案

方案 A:VrTicket.php 独立控制器(未完成)

在 app/admin/controller/VrTicket.php 创建独立控制器。

问题:MyView() 基于 theme 目录 app/admin/view/default/ 计算视图路径,plugins 符号链接在容器内无法 resolve(目标为绝对路径 /Users/bigemon/...,PHP 在容器内无法跟随)。

当前路径:plugins/vr_ticket/admin/view/seat_template/list.html
期望路径:app/plugins/vr_ticket/admin/view/seat_template/list.html
状态:模板文件 not found

方案 B:Seattemplate.php(已创建)

将 SeatTemplate.php 改名为 Seattemplate.php(小写 t)。

问题:权限 key 不匹配 + 原有 SeatTemplate.php 仍然存在

下一步(建议)

  1. 找一个真实可用的 ShopXO 插件(GitHub)
  2. 验证其后台管理页面能正常加载
  3. 分析其结构
  4. 将 vr_ticket 的业务逻辑逐步移植到该插件框架中

环境信息

  • PHP 容器: shopxo-php
  • DB: vrt_plugins(vr_ticket is_enable=1)
  • vrt_power 条目: id=1001-1005(VrTicket 控制器的权限已配置)
  • 权限缓存: 已确认 VR票务 entries 在 admin_left_menu 缓存中
## 问题描述 ShopXO 的 Plugins/Index 控制器在调用插件后台页面时有类名大小写问题,导致 vr_ticket 插件后台页面无法正常访问。 ## 根因分析 ### 1. Plugins/Index 控制器流程 URL: admin.php?s=Plugins/Index&pluginsname=vr_ticket&pluginscontrol=SeatTemplate&pluginsaction=List 1. Plugins/Index 读取参数: pluginsname=vr_ticket, pluginscontrol=SeatTemplate, pluginsaction=List 2. 执行 strtolower(\$pluginscontrol) → seattemplate 3. 调用 PluginsService::PluginsControlCall(vr_ticket, seattemplate, list, admin, ...) 4. PluginsControlCall 执行 ucfirst(seattemplate) → Seattemplate 5. 尝试实例化: \\\\app\\\\plugins\\\\vr_ticket\\\\admin\\\\Seattemplate 6. 类名不匹配 — 实际控制器类名是 SeatTemplate(大写 T),不是 Seattemplate ### 2. 权限 key 不匹配 PluginsAdminPowerMenu() 返回的 power key 格式是 seat_template-list(下划线分隔),而权限检查使用 URL 参数格式 plugins-seattemplate-index(无下划线),两者不匹配。 ## 尝试过的方案 ### 方案 A:VrTicket.php 独立控制器(未完成) 在 app/admin/controller/VrTicket.php 创建独立控制器。 问题:MyView() 基于 theme 目录 app/admin/view/default/ 计算视图路径,plugins 符号链接在容器内无法 resolve(目标为绝对路径 /Users/bigemon/...,PHP 在容器内无法跟随)。 当前路径:plugins/vr_ticket/admin/view/seat_template/list.html 期望路径:app/plugins/vr_ticket/admin/view/seat_template/list.html 状态:模板文件 not found ### 方案 B:Seattemplate.php(已创建) 将 SeatTemplate.php 改名为 Seattemplate.php(小写 t)。 问题:权限 key 不匹配 + 原有 SeatTemplate.php 仍然存在 ## 下一步(建议) 1. 找一个真实可用的 ShopXO 插件(GitHub) 2. 验证其后台管理页面能正常加载 3. 分析其结构 4. 将 vr_ticket 的业务逻辑逐步移植到该插件框架中 ## 环境信息 - PHP 容器: shopxo-php - DB: vrt_plugins(vr_ticket is_enable=1) - vrt_power 条目: id=1001-1005(VrTicket 控制器的权限已配置) - 权限缓存: 已确认 VR票务 entries 在 admin_left_menu 缓存中
sileya-ai self-assigned this 2026-04-15 23:23:28 +00:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sileya-ai/vr-shopxo-plugin#10
There is no content yet.