mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -5,6 +5,8 @@ namespace App\Console\Commands; | |||||||
| use Illuminate\Console\Command; | use Illuminate\Console\Command; | ||||||
| use App\Models\User; | use App\Models\User; | ||||||
| use App\Models\Order; | use App\Models\Order; | ||||||
|  | use App\Models\Server; | ||||||
|  | use App\Models\ServerLog; | ||||||
| use App\Utils\Helper; | use App\Utils\Helper; | ||||||
| use Illuminate\Support\Facades\Redis; | use Illuminate\Support\Facades\Redis; | ||||||
|  |  | ||||||
| @@ -43,6 +45,7 @@ class SystemCache extends Command | |||||||
|     { |     { | ||||||
|         $this->setMonthIncome(); |         $this->setMonthIncome(); | ||||||
|         $this->setMonthRegisterTotal(); |         $this->setMonthRegisterTotal(); | ||||||
|  |         $this->setMonthServerTrafficTotal(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private function setMonthIncome() { |     private function setMonthIncome() { | ||||||
| @@ -63,4 +66,15 @@ class SystemCache extends Command | |||||||
|                 ->count() |                 ->count() | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     private function setMonthServerTrafficTotal () { | ||||||
|  |         $servers = Server::get(); | ||||||
|  |         foreach ($servers as $item) { | ||||||
|  |             $serverLog = ServerLog::where('created_at', '>=', $item->created_at) | ||||||
|  |                 ->where('created_at', '<', strtotime('+1 month', $item->created_at)) | ||||||
|  |                 ->where('node_id', $item->id); | ||||||
|  |             Redis::set('month_server_traffic_total_u_' . $item->id, $serverLog->sum('u')); | ||||||
|  |             Redis::set('month_server_traffic_total_d_' . $item->id, $serverLog->sum('d')); | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ class Kernel extends ConsoleKernel | |||||||
|         // check commission |         // check commission | ||||||
|         $schedule->command('check:commission')->everyMinute(); |         $schedule->command('check:commission')->everyMinute(); | ||||||
|         // system cache |         // system cache | ||||||
|         $schedule->command('system:cache')->everyMinute(); |         $schedule->command('system:cache')->hourly(); | ||||||
|         // reset traffic |         // reset traffic | ||||||
|         $schedule->command('reset:traffic')->monthlyOn(1, '00:00'); |         $schedule->command('reset:traffic')->monthlyOn(1, '00:00'); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user