From 9a1b7e5071c79f8e8e5677ee5f5c8b2ae0492359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Fri, 23 Oct 2026 10:08:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=A8=A1=E5=9D=97=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=99=A8):=20=E5=85=BC=E5=AE=B9=E4=B8=8D=E5=90=8C=20MySQL=20?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8/=E7=89=88=E6=9C=AC=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8D=E5=A4=A7=E5=B0=8F=E5=86=99=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E6=AD=A3=E7=A1=AE=E8=AF=BB=E5=8F=96=E5=88=97=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/crmeb/module/BaseModuleInstaller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/crmeb/module/BaseModuleInstaller.php b/backend/crmeb/module/BaseModuleInstaller.php index fbf2be5a1..c50d83c21 100644 --- a/backend/crmeb/module/BaseModuleInstaller.php +++ b/backend/crmeb/module/BaseModuleInstaller.php @@ -1652,10 +1652,14 @@ abstract class BaseModuleInstaller implements ModuleInstallerInterface // 补齐 AI 提示词字段 $columns = Db::query( - 'SELECT column_name FROM information_schema.columns WHERE table_schema = ? AND table_name = ?', + 'SELECT COLUMN_NAME FROM information_schema.columns WHERE table_schema = ? AND table_name = ?', [$database, $fullTable] ); - $names = array_map(static fn ($row): string => (string) $row['COLUMN_NAME'], $columns); + // 不同 MySQL 驱动/版本返回的 information_schema 字段名大小写可能不同,做兼容读取。 + $names = array_map( + static fn ($row): string => (string)($row['COLUMN_NAME'] ?? $row['column_name'] ?? ''), + $columns + ); if (!in_array('system_prompt', $names, true)) { Db::execute("ALTER TABLE `{$fullTable}` ADD COLUMN `system_prompt` text COMMENT '系统AI提示词(AI写作的角色设定与格式要求)' AFTER `content`"); }