mirror of
https://github.com/v2board/v2board.git
synced 2025-02-11 16:00:27 +08:00
update: stat command
This commit is contained in:
parent
228355a520
commit
b39299be23
@ -61,6 +61,7 @@ class V2boardStatistics extends Command
|
||||
$statService->setStartAt($recordAt);
|
||||
$statService->setServerStats();
|
||||
$stats = $statService->getStatServer();
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
foreach ($stats as $stat) {
|
||||
if (!StatServer::insert([
|
||||
@ -73,12 +74,15 @@ class V2boardStatistics extends Command
|
||||
'record_type' => 'd',
|
||||
'record_at' => $recordAt
|
||||
])) {
|
||||
DB::rollback();
|
||||
throw new \Exception('stat server fail');
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
$statService->clearStatServer();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function statUser()
|
||||
@ -89,6 +93,7 @@ class V2boardStatistics extends Command
|
||||
$statService->setStartAt($recordAt);
|
||||
$statService->setUserStats();
|
||||
$stats = $statService->getStatUser();
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
foreach ($stats as $stat) {
|
||||
if (!StatUser::insert([
|
||||
@ -101,12 +106,15 @@ class V2boardStatistics extends Command
|
||||
'record_type' => 'd',
|
||||
'record_at' => $recordAt
|
||||
])) {
|
||||
DB::rollback();
|
||||
throw new \Exception('stat user fail');
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
$statService->clearStatUser();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function stat()
|
||||
|
Loading…
x
Reference in New Issue
Block a user