From e7aa648486f184bdb4c005ec2bd800cdb61d8fe2 Mon Sep 17 00:00:00 2001 From: augushong Date: Thu, 17 Oct 2019 19:44:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=8D=E7=BD=AE=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/ResetPassword.php | 33 +++++++++++++++++++++++++++++++++ config/console.php | 1 + 2 files changed, 34 insertions(+) create mode 100644 app/command/ResetPassword.php diff --git a/app/command/ResetPassword.php b/app/command/ResetPassword.php new file mode 100644 index 0000000..844f45c --- /dev/null +++ b/app/command/ResetPassword.php @@ -0,0 +1,33 @@ +setName('reset_password') + ->setDescription('the reset_password command'); + } + + protected function execute(Input $input, Output $output) + { + // 指令输出 + + $account['salt'] = Str::random(6); + $account['password'] = md5('123456'.$account['salt']); + Admin::update($account,1); + $output->writeln('重置密码成功'); + } +} diff --git a/config/console.php b/config/console.php index a818a98..61e4229 100644 --- a/config/console.php +++ b/config/console.php @@ -5,5 +5,6 @@ return [ // 指令定义 'commands' => [ + 'app\command\ResetPassword' ], ];