info('开始创建宝箱配置表...'); try { // 检查表是否已存在 $tableExists = DB::select("SHOW TABLES LIKE 'kku_item_chest_configs'"); if ($tableExists) { $this->info('宝箱配置表已存在,跳过创建'); return 0; } // 读取并执行SQL文件 $sqlFile = app_path('Module/GameItems/Databases/GenerateSql/item_items_chest_groups_update.sql'); if (!file_exists($sqlFile)) { $this->error('SQL文件不存在: ' . $sqlFile); return 1; } $sql = file_get_contents($sqlFile); DB::unprepared($sql); $this->info('✓ 宝箱配置表创建成功'); $this->info('宝箱数据库结构更新完成!'); return 0; } catch (\Exception $e) { $this->error('更新失败: ' . $e->getMessage()); return 1; } } }