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->setStartAt($recordAt);
|
||||||
$statService->setServerStats();
|
$statService->setServerStats();
|
||||||
$stats = $statService->getStatServer();
|
$stats = $statService->getStatServer();
|
||||||
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
foreach ($stats as $stat) {
|
foreach ($stats as $stat) {
|
||||||
if (!StatServer::insert([
|
if (!StatServer::insert([
|
||||||
@ -73,12 +74,15 @@ class V2boardStatistics extends Command
|
|||||||
'record_type' => 'd',
|
'record_type' => 'd',
|
||||||
'record_at' => $recordAt
|
'record_at' => $recordAt
|
||||||
])) {
|
])) {
|
||||||
DB::rollback();
|
|
||||||
throw new \Exception('stat server fail');
|
throw new \Exception('stat server fail');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
$statService->clearStatServer();
|
$statService->clearStatServer();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function statUser()
|
private function statUser()
|
||||||
@ -89,6 +93,7 @@ class V2boardStatistics extends Command
|
|||||||
$statService->setStartAt($recordAt);
|
$statService->setStartAt($recordAt);
|
||||||
$statService->setUserStats();
|
$statService->setUserStats();
|
||||||
$stats = $statService->getStatUser();
|
$stats = $statService->getStatUser();
|
||||||
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
foreach ($stats as $stat) {
|
foreach ($stats as $stat) {
|
||||||
if (!StatUser::insert([
|
if (!StatUser::insert([
|
||||||
@ -101,12 +106,15 @@ class V2boardStatistics extends Command
|
|||||||
'record_type' => 'd',
|
'record_type' => 'd',
|
||||||
'record_at' => $recordAt
|
'record_at' => $recordAt
|
||||||
])) {
|
])) {
|
||||||
DB::rollback();
|
|
||||||
throw new \Exception('stat user fail');
|
throw new \Exception('stat user fail');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
$statService->clearStatUser();
|
$statService->clearStatUser();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function stat()
|
private function stat()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user