From 9680a019909c4fead7777d6518b47806b9b43e07 Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Sat, 10 Oct 2020 15:32:30 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/Install.php | 9 +++------ install/apiRoute.tpl | 12 +++++++++--- install/apiadmin.tpl | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/command/Install.php b/app/command/Install.php index 08b16d5..eeb1e8a 100644 --- a/app/command/Install.php +++ b/app/command/Install.php @@ -7,14 +7,11 @@ use app\util\Strs; use think\console\Command; use think\console\Input; use think\console\Output; -use think\db\Connection; class Install extends Command { protected function configure(): void { - // 指令配置 - $this->setName('apiadmin:install') - ->setDescription('ApiAdmin安装脚本'); + $this->setName('apiadmin:install')->setDescription('ApiAdmin安装脚本'); } /** @@ -53,8 +50,8 @@ class Install extends Command { try { $options = $this->parseDsnConfig($output); - - Connection::instance($options)->getTables($options['database']); + $dsn = "{$options['type']}:dbname={$options['database']};host={$options['hostname']};port={$options['hostport']};charset={$options['charset']}"; + new \PDO($dsn, $options['username'], $options['password']); //处理数据库配置文件 $dbConf = str_replace([ diff --git a/install/apiRoute.tpl b/install/apiRoute.tpl index 70dc76f..1b2bdfa 100644 --- a/install/apiRoute.tpl +++ b/install/apiRoute.tpl @@ -1,7 +1,13 @@ +// +---------------------------------------------------------------------- use think\facade\Route; diff --git a/install/apiadmin.tpl b/install/apiadmin.tpl index 3cbcc46..a376139 100644 --- a/install/apiadmin.tpl +++ b/install/apiadmin.tpl @@ -1,12 +1,12 @@ +// | Author: zhaoxiang // +---------------------------------------------------------------------- return [