add:新增初始化管理密码命令

This commit is contained in:
JaguarJack 2021-01-20 19:19:28 +08:00
parent b12edc9439
commit 2ae7efce04
2 changed files with 34 additions and 5 deletions

View File

@ -3,16 +3,11 @@ declare (strict_types = 1);
namespace catcher\command\Tools;
use catcher\CatchAdmin;
use catcher\facade\FileSystem;
use catcher\library\BackUpDatabase;
use catcher\library\Zip;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\Db;
class BackupCommand extends Command
{

View File

@ -0,0 +1,34 @@
<?php
declare (strict_types=1);
namespace catcher\command\Tools;
use catchAdmin\permissions\model\Users;
use catcher\library\BackUpDatabase;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\Output;
class InitRootCommand extends Command
{
protected $table;
protected function configure()
{
// 指令配置
$this->setName('catch:initAdmin')
->setDescription('backup data you need');
}
protected function execute(Input $input, Output $output)
{
if ($user = Users::where('id', config('catch.permissions.super_admin_id'))->find()) {
$user->password = 'catchadmin';
$user->save();
}
}
}