'ThemeConfigurator', 'title' => '主题可视化配置', 'description' => '通过插件管理 BlackFruit-UI 导航、页脚、SEO、轮播与侧边栏等主题参数', 'author' => 'yiqiu', 'version' => '1.0.0', ]; /** @var bool 标记不需要默认插件导航 */ public $noNav = false; /** * 安装插件 - 初始化存储表以及默认配置 */ public function install() { try { Db::execute( "CREATE TABLE IF NOT EXISTS `addon_theme_configurator`( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `config` longtext NOT NULL, `update_time` int(11) DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" ); } catch (\Throwable $throwable) { return [ 'status' => 400, 'msg' => $throwable->getMessage(), ]; } (new ThemeConfigModel())->initConfig(); return [ 'status' => 200, 'msg' => lang_plugins('theme_configurator_install_success'), ]; } /** * 卸载插件 - 移除存储表 */ public function uninstall() { try { Db::execute("DROP TABLE IF EXISTS `addon_theme_configurator`;"); } catch (\Throwable $throwable) { return [ 'status' => 400, 'msg' => $throwable->getMessage(), ]; } return [ 'status' => 200, 'msg' => lang_plugins('theme_configurator_uninstall_success'), ]; } /** * 供其他业务调用,快速获取主题配置 */ public function getThemeConfig() { return (new ThemeConfigModel())->getConfig(); } }