From bb1a59291ffc804b65ef0b4741473074f561bbcf Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Mon, 14 Sep 2020 17:43:47 +0800 Subject: [PATCH] fix: reset traffic --- app/Console/Commands/ResetTraffic.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/ResetTraffic.php b/app/Console/Commands/ResetTraffic.php index d73d8e3f..44b799a8 100644 --- a/app/Console/Commands/ResetTraffic.php +++ b/app/Console/Commands/ResetTraffic.php @@ -7,7 +7,7 @@ use App\Models\User; class ResetTraffic extends Command { - protected $user; + protected $builder; /** * The name and signature of the console command. * @@ -30,7 +30,7 @@ class ResetTraffic extends Command public function __construct() { parent::__construct(); - $this->user = User::where('expired_at', '!=', NULL) + $this->builder = User::where('expired_at', '!=', NULL) ->where('expired_at', '>', time()); } @@ -56,9 +56,9 @@ class ResetTraffic extends Command private function resetByMonthFirstDay():void { - $user = $this->user; + $builder = $this->builder; if ((string)date('d') === '01') { - $user->update([ + $builder->update([ 'u' => 0, 'd' => 0 ]); @@ -67,10 +67,10 @@ class ResetTraffic extends Command private function resetByExpireDay():void { - $user = $this->user; + $builder = $this->builder; $lastDay = date('d', strtotime('last day of +0 months')); $users = []; - foreach ($user->get() as $item) { + foreach ($builder->get() as $item) { $expireDay = date('d', $item->expired_at); $today = date('d'); if ($expireDay === $today) {