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' ], ];