Traffic
This commit is contained in:
parent
8019a3f9a7
commit
da043fd71b
1 changed files with 20 additions and 8 deletions
|
@ -56,6 +56,16 @@ class CalculateTraffic extends Command
|
||||||
var_dump($result);
|
var_dump($result);
|
||||||
foreach ($result as $key => $trafficSize) {
|
foreach ($result as $key => $trafficSize) {
|
||||||
$split = explode("-", $key);
|
$split = explode("-", $key);
|
||||||
|
if(empty($split[1])) {
|
||||||
|
$traffic = Traffic::query()
|
||||||
|
->where("tenant", "=", (int)$split[0])
|
||||||
|
->whereNull("gallery")
|
||||||
|
->where("year", "=", (int)$split[2])
|
||||||
|
->where("month", "=", (int)$split[3])
|
||||||
|
->where("day", "=", (int)$split[4])
|
||||||
|
->where("hour", "=", (int)$split[5])
|
||||||
|
->first();
|
||||||
|
} else {
|
||||||
$traffic = Traffic::query()
|
$traffic = Traffic::query()
|
||||||
->where("tenant", "=", (int)$split[0])
|
->where("tenant", "=", (int)$split[0])
|
||||||
->where("gallery", "=", (int)$split[1])
|
->where("gallery", "=", (int)$split[1])
|
||||||
|
@ -64,6 +74,8 @@ class CalculateTraffic extends Command
|
||||||
->where("day", "=", (int)$split[4])
|
->where("day", "=", (int)$split[4])
|
||||||
->where("hour", "=", (int)$split[5])
|
->where("hour", "=", (int)$split[5])
|
||||||
->first();
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
if($traffic == null) {
|
if($traffic == null) {
|
||||||
$traffic = new Traffic();
|
$traffic = new Traffic();
|
||||||
$traffic->tenant = $split[0];
|
$traffic->tenant = $split[0];
|
||||||
|
|
Loading…
Reference in a new issue