From a842c3fc41ce4b845374353eba2ec9a60eac12c9 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Tue, 14 May 2019 00:30:34 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/command/Install.php | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 application/command/Install.php diff --git a/application/command/Install.php b/application/command/Install.php new file mode 100644 index 0000000..4e0f6d3 --- /dev/null +++ b/application/command/Install.php @@ -0,0 +1,44 @@ +setName('apiadmin:install') + ->addOption('db', null, Option::VALUE_REQUIRED, '数据库连接参数,格式为:数据库类型://用户名:密码@数据库地址:数据库端口/数据库名#字符集') + ->addOption('username', null, Option::VALUE_REQUIRED, '超管账号名', 'root') + ->addOption('password', null, Option::VALUE_REQUIRED, '超管账号密码', '123456') + ->setDescription('ApiAdmin安装脚本'); + } + + /** + * @param Input $input + * @param Output $output + * @return int|void|null + * @throws \think\Exception + * @author zhaoxiang + */ + protected function execute(Input $input, Output $output) { + if ($input->hasOption('db')) { + $conn = Db::connect($input->getOption('db'))->table('admin_user'); + + try { + $conn->insert([ + + ]); + } catch (\Exception $e) { + echo 123123; + } + } else { + $output->highlight("请输入数据库配置"); + } + } +}