增加初始化admin账号密码命令行;修改部分声明;增加表注释生成关联的功能;

This commit is contained in:
augushong
2021-11-29 18:26:07 +08:00
parent 6f461fa6b6
commit 10046031e6
8 changed files with 157 additions and 74 deletions

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace app\common\command\admin;
use app\admin\model\SystemAdmin;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
class ResetPassword extends Command
{
protected function configure()
{
// 指令配置
$this->setName('admin:resetPassword')
->setDescription('the admin:resetPassword command');
}
protected function execute(Input $input, Output $output)
{
// 指令输出
$output->writeln('admin:resetPassword');
$model_admin = SystemAdmin::where('username', 'admin')->find();
if (empty($model_admin)) {
$output->writeln('管理员不存在');
return false;
}
$model_admin->save([
'password' => password(123456)
]);
$output->writeln('修改成功');
}
}