diff --git a/app/Console/Commands/V2boardStatistics.php b/app/Console/Commands/V2boardStatistics.php index 0e77d1cf..05e5f681 100644 --- a/app/Console/Commands/V2boardStatistics.php +++ b/app/Console/Commands/V2boardStatistics.php @@ -66,10 +66,11 @@ class V2boardStatistics extends Command 'record_at' => $recordAt ])) { DB::rollback(); - break; + throw new \Exception('stat user fail'); } } DB::commit(); + $statService->clearStatUser(); } private function statOrder() diff --git a/app/Services/StatisticalService.php b/app/Services/StatisticalService.php index f8691c83..5d4270c2 100644 --- a/app/Services/StatisticalService.php +++ b/app/Services/StatisticalService.php @@ -7,7 +7,7 @@ class StatisticalService { protected $userStats; protected $recordAt; - public function __construct($recordAt = '') + public function __construct($recordAt = NULL) { ini_set('memory_limit', -1); $this->recordAt = $recordAt ?? strtotime(date('Y-m-d')); @@ -50,4 +50,9 @@ class StatisticalService { } return $stats; } + + public function clearStatUser() + { + Cache::forget("stat_user_{$this->recordAt}"); + } }