fix: 修复 vr_ticket 插件文件被 gitignore 忽略的问题
- 强制追踪 vr_ticket/Event.php(被 shopxo/app/.gitignore 的 event.php 规则遮蔽) - 强制追踪 vr_ticket/database/migrations/*.sql(被全局 gitignore 的 database 规则遮蔽) - 删除 shopxo/app/.gitignore(规则过宽,影响插件文件) - 追踪 shopxo/app/event.php(ShopXO 源码,被上条 .gitignore 遮蔽) - 更新项目 .gitignore(vendor/upload/adminufgeyw/强制追踪database)council/SecurityEngineer
parent
f3f12e3ea5
commit
bbb2e65330
|
|
@ -13,3 +13,6 @@ shopxo/data.db
|
|||
# ShopXO installation files (auto-generated during install, do not track)
|
||||
shopxo/adminufgeyw.php
|
||||
shopxo/public/adminufgeyw.php
|
||||
|
||||
# 强制追踪 vr_ticket 插件的 database 目录(全局 gitignore 的 database 规则过宽)
|
||||
!shopxo/app/plugins/vr_ticket/database/
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
event.php
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用行为扩展定义文件
|
||||
return array (
|
||||
'listen' =>
|
||||
array (
|
||||
'plugins_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\my_test_plugin\\Hook',
|
||||
),
|
||||
'plugins_js' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\my_test_plugin\\Hook',
|
||||
),
|
||||
'plugins_service_admin_menu_data' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\Hook',
|
||||
),
|
||||
'plugins_service_order_pay_success_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\Hook',
|
||||
),
|
||||
'plugins_service_order_delete_success' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\Hook',
|
||||
),
|
||||
'plugins_view_admin_goods_save' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\hook\\AdminGoodsSave',
|
||||
),
|
||||
'plugins_service_goods_save_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\hook\\AdminGoodsSaveHandle',
|
||||
),
|
||||
'plugins_service_goods_save_thing_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\vr_ticket\\hook\\AdminGoodsSaveHandle',
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
namespace app\plugins\vr_ticket;
|
||||
|
||||
class Event
|
||||
{
|
||||
public function Install($params = [])
|
||||
{
|
||||
$db = \think\facade\Db::connect();
|
||||
$prefix = \think\facade\Config::get('database.connections.mysql.prefix');
|
||||
|
||||
// 给 ShopXO 商品表追加 item_type 字段(MySQL 5.x 兼容写法)
|
||||
$query = $db->query("SHOW COLUMNS FROM `{$prefix}goods` LIKE 'item_type'");
|
||||
if (count($query) == 0) {
|
||||
$db->execute("ALTER TABLE `{$prefix}goods` ADD COLUMN `item_type` VARCHAR(20) NOT NULL DEFAULT 'normal' COMMENT '商品类型:normal=普通 goods ticket=票务 physical=周边' AFTER `is_shelves`");
|
||||
}
|
||||
|
||||
$queryConfig = $db->query("SHOW COLUMNS FROM `{$prefix}goods` LIKE 'vr_goods_config'");
|
||||
if (count($queryConfig) == 0) {
|
||||
$db->execute("ALTER TABLE `{$prefix}goods` ADD COLUMN `vr_goods_config` LONGTEXT COMMENT '票务配置' AFTER `item_type`");
|
||||
}
|
||||
}
|
||||
|
||||
public function Uninstall($params = [])
|
||||
{
|
||||
// 卸载操作通常由 uninstall.sql 完成
|
||||
}
|
||||
|
||||
public function Upgrade($params = [])
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- =====================================================
|
||||
-- VR票务插件 - 数据库迁移(一次性创建全部表)
|
||||
-- ShopXO 表前缀:vrt_(安装时动态获取实际前缀)
|
||||
-- 执行方式:ShopXO 后台安装时自动执行 EventListener.php
|
||||
-- AI 参与度:100%
|
||||
-- =====================================================
|
||||
|
||||
-- 以下 SQL 由 EventListener.php 在安装时自动执行
|
||||
-- 此文件仅作为备份参考,实际以 EventListener.php 中为准
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
-- =====================================================
|
||||
-- VR票务插件 - 乱码修复 SQL
|
||||
-- 症状:侧边栏显示 `VR票务`(应为 `VR票务`)
|
||||
-- 根因:plugins 表的 name 字段存储了 UTF-8 字节序列被当作 Latin1 编码
|
||||
-- `VR票务` 的 UTF-8 字节 \xE5\xA5\x96\xE5\x8A\xA1 被 Latin1 解码为 `票务`
|
||||
--
|
||||
-- 执行方式:在 phpMyAdmin 或 MySQL CLI 中执行
|
||||
-- 注意:请先备份数据库再执行
|
||||
-- =====================================================
|
||||
|
||||
-- Step 1: 确认乱码状态(应看到 `VR票务`)
|
||||
-- SELECT `name` FROM `{前缀}plugins` WHERE `identifier` LIKE '%vr_ticket%';
|
||||
|
||||
-- Step 2: 修复 plugins 表的 name 字段
|
||||
-- 使用 BINARY 强制以二进制读取,然后正确转换编码
|
||||
UPDATE `{前缀}plugins`
|
||||
SET `name` = CONVERT(BINARY CONVERT(`name` USING latin1) USING utf8mb4)
|
||||
WHERE `identifier` LIKE '%vr_ticket%'
|
||||
AND `name` != 'VR票务';
|
||||
|
||||
-- Step 3: 确认修复结果(应显示 `VR票务`)
|
||||
-- SELECT `name` FROM `{前缀}plugins` WHERE `identifier` LIKE '%vr_ticket%';
|
||||
|
||||
-- 同时检查 vrt_power 表(如果有权限配置)
|
||||
-- Step 4: 检查并修复 vrt_power 表的 name 字段(如果存在且有乱码)
|
||||
-- UPDATE `{前缀}vrt_power`
|
||||
-- SET `name` = CONVERT(BINARY CONVERT(`name` USING latin1) USING utf8mb4)
|
||||
-- WHERE `name` LIKE '%票%';
|
||||
|
||||
-- =====================================================
|
||||
-- 原理说明:
|
||||
-- UTF-8 → Latin1 双重编码的修复:
|
||||
-- 1. BINARY CONVERT(... USING latin1) — 以 Latin1 重新解读乱码字节
|
||||
-- `票务` 的 Latin1 字节 = \xE5\xA5\x96\xE5\x8A\xA1
|
||||
-- 2. CONVERT(... USING utf8mb4) — 将字节以 UTF-8 解码
|
||||
-- \xE5\xA5\x96\xE5\x8A\xA1 → `票务` ✓
|
||||
-- =====================================================
|
||||
Loading…
Reference in New Issue