'); // 全局注册行为事件 Hook::register(); if (request()->isCli()) { \think\Console::addDefaultCommands([ 'addons\shopro\console\ShoproChat', 'addons\shopro\console\ShoproHelp' ]); } } private static function getMenu() { $newMenu = []; $config_file = ADDON_PATH . "shopro" . DS . 'config' . DS . "menu.php"; if (is_file($config_file)) { $newMenu = include $config_file; } $oldMenu = AuthRule::where('name', 'like', "shopro%")->select(); $oldMenu = array_column($oldMenu, null, 'name'); return ['new' => $newMenu, 'old' => $oldMenu]; } private static function addScript() { $script_path = APP_PATH . 'admin/view/common/script.html'; $script = file_get_contents($script_path); if (strpos($script, '{$VUE_ELEMENTPLUS}') === false) { $script = '{$VUE_ELEMENTPLUS}' . $script; file_put_contents($script_path, $script); } } private static function delScript() { $script_path = APP_PATH . 'admin/view/common/script.html'; $script = file_get_contents($script_path); if (strpos($script, '{$VUE_ELEMENTPLUS}') !== false) { $script = str_replace('{$VUE_ELEMENTPLUS}', '', $script); file_put_contents($script_path, $script); } } }