From ae0fd63929c47045be5f3c4e2ac14836c4f02b6f Mon Sep 17 00:00:00 2001 From: v2board Date: Wed, 3 May 2023 15:43:20 +0800 Subject: [PATCH] update: statistics service --- app/Console/Commands/V2boardStatistics.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/V2boardStatistics.php b/app/Console/Commands/V2boardStatistics.php index bc907caf..31812fa5 100644 --- a/app/Console/Commands/V2boardStatistics.php +++ b/app/Console/Commands/V2boardStatistics.php @@ -59,7 +59,8 @@ class V2boardStatistics extends Command $recordAt = strtotime('-1 day', strtotime(date('Y-m-d'))); $statService = new StatisticalService(); $statService->setStartAt($recordAt); - $stats = $statService->getStatUser(); + $statService->setServerStats(); + $stats = $statService->getStatServer(); DB::beginTransaction(); foreach ($stats as $stat) { if (!StatServer::insert([ @@ -86,6 +87,7 @@ class V2boardStatistics extends Command $recordAt = strtotime('-1 day', strtotime(date('Y-m-d'))); $statService = new StatisticalService(); $statService->setStartAt($recordAt); + $statService->setUserStats(); $stats = $statService->getStatUser(); DB::beginTransaction(); foreach ($stats as $stat) { @@ -109,9 +111,11 @@ class V2boardStatistics extends Command private function stat() { - $startAt = strtotime('-1 day', strtotime(date('Y-m-d'))); + $endAt = strtotime(date('Y-m-d')); + $startAt = strtotime('-1 day', $endAt); $statisticalService = new StatisticalService(); - $statisticalService->setRecordAt($startAt); + $statisticalService->setStartAt($startAt); + $statisticalService->setEndAt($endAt); $data = $statisticalService->generateStatData(); $statistic = Stat::where('record_at', $startAt) ->where('record_type', 'd')