mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-04 09:02:49 +08:00
增加扩展机制定位文件;将common模块实现扩展模式;发布新版本;
This commit is contained in:
@@ -4,47 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\common\command\admin;
|
||||
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\common\constants\AdminConstant;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\input\Argument;
|
||||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
use base\common\command\admin\ResetPasswordBase;
|
||||
|
||||
class ResetPassword extends Command
|
||||
class ResetPassword extends ResetPasswordBase
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
// 指令配置
|
||||
$this->setName('admin:reset:password')
|
||||
->addOption('password','p', Option::VALUE_OPTIONAL)
|
||||
->setDescription('重置超管密码');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
// 指令输出
|
||||
$output->writeln('admin:reset:password');
|
||||
|
||||
|
||||
$model_admin = SystemAdmin::find(AdminConstant::SUPER_ADMIN_ID);
|
||||
if (empty($model_admin)) {
|
||||
$output->writeln('管理员不存在');
|
||||
return false;
|
||||
}
|
||||
|
||||
$password = $input->getOption('password');
|
||||
|
||||
if(is_null($password)){
|
||||
$password = uniqid();
|
||||
}
|
||||
|
||||
|
||||
$model_admin->save([
|
||||
'password' => password($password)
|
||||
]);
|
||||
|
||||
$output->writeln('密码修改为:' . $password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user