mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	update: reset user
This commit is contained in:
		
							
								
								
									
										55
									
								
								app/Console/Commands/ResetUser.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								app/Console/Commands/ResetUser.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Console\Commands; | ||||||
|  |  | ||||||
|  | use App\Models\Plan; | ||||||
|  | use App\Utils\Helper; | ||||||
|  | use Illuminate\Console\Command; | ||||||
|  | use App\Models\User; | ||||||
|  | use Illuminate\Support\Facades\DB; | ||||||
|  |  | ||||||
|  | class ResetUser extends Command | ||||||
|  | { | ||||||
|  |     protected $builder; | ||||||
|  |     /** | ||||||
|  |      * The name and signature of the console command. | ||||||
|  |      * | ||||||
|  |      * @var string | ||||||
|  |      */ | ||||||
|  |     protected $signature = 'reset:user'; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * The console command description. | ||||||
|  |      * | ||||||
|  |      * @var string | ||||||
|  |      */ | ||||||
|  |     protected $description = '重置所有用户信息'; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Create a new command instance. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function __construct() | ||||||
|  |     { | ||||||
|  |         parent::__construct(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Execute the console command. | ||||||
|  |      * | ||||||
|  |      * @return mixed | ||||||
|  |      */ | ||||||
|  |     public function handle() | ||||||
|  |     { | ||||||
|  |         ini_set('memory_limit', -1); | ||||||
|  |         $users = User::all(); | ||||||
|  |         foreach ($users as $user) | ||||||
|  |         { | ||||||
|  |             $user->token = Helper::guid(); | ||||||
|  |             $user->uuid = Helper::guid(true); | ||||||
|  |             $user->save(); | ||||||
|  |             $this->info("已重置用户{$user->email}的安全信息"); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user