From 2a1ceffa60d63827753d35205de8c419bae87169 Mon Sep 17 00:00:00 2001 From: smdev Date: Tue, 31 Dec 2019 17:18:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=97=B6=E7=94=9F=E6=88=90=E7=BD=91=E7=AB=99=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + application/admin/command/Install.php | 17 ++++++++++++ application/extra/site.php | 38 --------------------------- public/install.php | 18 +++++++++++++ 4 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 application/extra/site.php diff --git a/.gitignore b/.gitignore index 3f2ebf8ce..44653c4cf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /runtime/* /addons/* /application/admin/command/Install/*.lock +/application/extra/site.php /public/assets/libs/ /public/assets/addons/* /public/uploads/* diff --git a/application/admin/command/Install.php b/application/admin/command/Install.php index 3be7f9493..842ed772a 100644 --- a/application/admin/command/Install.php +++ b/application/admin/command/Install.php @@ -103,6 +103,23 @@ class Install extends Command \think\Cache::rm('__menu__'); + // 生成站点配置文件 + $config = []; + foreach (model('app\common\model\Config')->all() as $k => $v) { + $value = $v->toArray(); + if (in_array($value['type'], ['selects', 'checkbox', 'images', 'files'])) { + $value['value'] = explode(',', $value['value']); + } + if ($value['type'] == 'array') { + $value['value'] = (array)json_decode($value['value'], true); + } + $config[$value['name']] = $value['value']; + } + file_put_contents( + APP_PATH . 'extra' . DS . 'site.php', + 'info("Install Successed!"); } } diff --git a/application/extra/site.php b/application/extra/site.php deleted file mode 100644 index 437899ac0..000000000 --- a/application/extra/site.php +++ /dev/null @@ -1,38 +0,0 @@ - 'FastAdmin', - 'beian' => '', - 'cdnurl' => '', - 'version' => '1.0.1', - 'timezone' => 'Asia/Shanghai', - 'forbiddenip' => '', - 'languages' => - array ( - 'backend' => 'zh-cn', - 'frontend' => 'zh-cn', - ), - 'fixedpage' => 'dashboard', - 'categorytype' => - array ( - 'default' => 'Default', - 'page' => 'Page', - 'article' => 'Article', - 'test' => 'Test', - ), - 'configgroup' => - array ( - 'basic' => 'Basic', - 'email' => 'Email', - 'dictionary' => 'Dictionary', - 'user' => 'User', - 'example' => 'Example', - ), - 'mail_type' => '1', - 'mail_smtp_host' => 'smtp.qq.com', - 'mail_smtp_port' => '465', - 'mail_smtp_user' => '10000', - 'mail_smtp_pass' => 'password', - 'mail_verify_type' => '2', - 'mail_from' => '10000@qq.com', -); \ No newline at end of file diff --git a/public/install.php b/public/install.php index bcade4089..0d4677c15 100644 --- a/public/install.php +++ b/public/install.php @@ -190,6 +190,24 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { $adminName = substr(str_shuffle(str_repeat($x, ceil(10 / strlen($x)))), 1, 10) . '.php'; rename($adminFile, ROOT_PATH . 'public' . DS . $adminName); } + + // 生成站点配置文件 + $config = []; + $config_list = $pdo->query("SELECT * FROM {$mysqlPrefix}config ORDER BY id ASC"); + foreach ($config_list as $k => $v) { + if (in_array($v['type'], ['selects', 'checkbox', 'images', 'files'])) { + $v['value'] = explode(',', $v['value']); + } + if ($v['type'] == 'array') { + $v['value'] = (array)json_decode($v['value'], true); + } + $config[$v['name']] = $v['value']; + } + file_put_contents( + APP_PATH . 'extra' . DS . 'site.php', + 'getMessage(); -- Gitee