mirror of
				https://github.com/v2board/v2board.git
				synced 2025-11-01 01:41:47 +08:00 
			
		
		
		
	update: add client token in cache
This commit is contained in:
		
							
								
								
									
										49
									
								
								app/Console/Commands/CacheToken.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								app/Console/Commands/CacheToken.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Console\Commands; | ||||
|  | ||||
| use App\Utils\CacheKey; | ||||
| use Illuminate\Console\Command; | ||||
| use App\Services\UserService; | ||||
| use Illuminate\Support\Facades\Cache; | ||||
|  | ||||
| class CacheToken extends Command | ||||
| { | ||||
|     /** | ||||
|      * The name and signature of the console command. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $signature = 'cache:token'; | ||||
|  | ||||
|     /** | ||||
|      * 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() | ||||
|     { | ||||
|         $userService = new UserService(); | ||||
|         $users = $userService->getAvailableUsers(); | ||||
|         foreach ($users as $user) { | ||||
|             Cache::put(CacheKey::get('SUBSCRIBE_TOKEN', $user->token), 1, 120); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -29,6 +29,7 @@ class Kernel extends ConsoleKernel | ||||
|         Cache::put(CacheKey::get('SCHEDULE_LAST_CHECK_AT', null), time()); | ||||
|         // v2board | ||||
|         $schedule->command('v2board:statistics')->dailyAt('0:10'); | ||||
|         $schedule->command('cache:token')->everyMinute(); | ||||
|         // check | ||||
|         $schedule->command('check:order')->everyMinute(); | ||||
|         $schedule->command('check:commission')->everyMinute(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user